mirror of
https://github.com/google/blockly.git
synced 2026-01-10 10:27:08 +01:00
chore: Use .includes and .startsWith, not .indexOf (#7936)
Easier to read than the diverse collection of `=== 0` and `!== -1` and `> -1` tests.
This commit is contained in:
@@ -225,9 +225,9 @@ function wrapScore(
|
||||
score -= Math.pow(maxLength - lineLengths[i], 1.5);
|
||||
// Optimize for structure.
|
||||
// Add score to line endings after punctuation.
|
||||
if ('.?!'.indexOf(linePunctuation[i]) !== -1) {
|
||||
if ('.?!'.includes(linePunctuation[i])) {
|
||||
score += limit / 3;
|
||||
} else if (',;)]}'.indexOf(linePunctuation[i]) !== -1) {
|
||||
} else if (',;)]}'.includes(linePunctuation[i])) {
|
||||
score += limit / 4;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user