Skip to content

Commit 498117c

Browse files
committed
Refactored the tokenizer to fix code climite
1 parent f1e9e8d commit 498117c

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

parser/tokenizer.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -359,19 +359,18 @@ export class HedStringTokenizer {
359359
}
360360
}
361361

362-
checkForBadPlaceholderIssues(i) {
362+
checkForBadPlaceholderIssues() {
363363
const tokenSplit = this.state.currentToken.split(CHARACTERS.PLACEHOLDER)
364364
if (tokenSplit.length === 1) {
365365
// No placeholders to worry about for this tag
366366
return false
367-
} else if (tokenSplit.length > 2) {
368-
// Multiple placeholders
369-
return true
370-
} else if (!tokenSplit[0].endsWith(CHARACTERS.SLASH)) {
371-
// A placeholder must come immediately after a slash
372-
return true
373-
} else if (tokenSplit[1].trim().length > 0 && tokenSplit[1][0] !== CHARACTERS.BLANK) {
374-
// If units, blank must follow placeholder
367+
}
368+
if (
369+
tokenSplit.length > 2 ||
370+
!tokenSplit[0].endsWith(CHARACTERS.SLASH) || // A placeholder must be after a slash
371+
(tokenSplit[1].trim().length > 0 && tokenSplit[1][0] !== CHARACTERS.BLANK)
372+
) {
373+
// If units, blank after placeholder
375374
return true
376375
}
377376
return false

0 commit comments

Comments
 (0)