Skip to content

Commit 030eb97

Browse files
committed
simplify boolean var
1 parent 50bbee7 commit 030eb97

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

script/update-internal-links.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,7 @@ async function main () {
101101
// As a blanket rule, only update titles in links that have quotes around them.
102102
// Update: "[Foo](/foo)"
103103
// Do not update: [Bar](/bar)
104-
let noQuotesAroundLink
105-
if (!newContent.includes(`"${oldMarkdownLink}`)) {
106-
noQuotesAroundLink = true
107-
}
104+
const hasQuotesAroundLink = newContent.includes(`"${oldMarkdownLink}`)
108105

109106
let foundPage, fragmentMatch, versionMatch
110107

@@ -142,7 +139,7 @@ async function main () {
142139
// If the original link includes a fragment or the original title includes Liquid, do not change;
143140
// otherwise, use the found page title. (We don't want to update the title if a fragment is found because
144141
// the title likely points to the fragment section header, not the page title.)
145-
const newTitle = fragmentMatch || oldTitle.includes('{%') || noQuotesAroundLink ? oldTitle : foundPage.title
142+
const newTitle = fragmentMatch || oldTitle.includes('{%') || !hasQuotesAroundLink ? oldTitle : foundPage.title
146143

147144
// If the original link includes a fragment, append it to the found page path.
148145
// Also remove the language code because Markdown links don't include language codes.

0 commit comments

Comments
 (0)