Skip to content

Commit 5aea817

Browse files
committed
Replace Array.prototype.every() with for loop
`.every()` short-circuits on the first `false`
1 parent 580da89 commit 5aea817

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎scripts/changetool/index.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,15 @@ function usage(): number {
3737
}
3838

3939
function validate(paths: string[]): number {
40+
let valid = true;
4041
if (paths.length === 0) {
4142
console.error("error: no paths provided (see 'help' command for usage)");
4243
return 1;
4344
}
44-
return paths.every((path) => isValidChangenoteFile(path)) ? 0 : 1;
45+
for (const path of paths) {
46+
if (!isValidChangenoteFile(path)) {
47+
valid = false;
48+
}
49+
}
50+
return valid ? 0 : 1;
4551
}

0 commit comments

Comments
 (0)