Skip to content
Prev Previous commit
Next Next commit
Replace Array.prototype.every() with for loop
`.every()` short-circuits on the first `false`
  • Loading branch information
mario-campos committed Aug 27, 2026
commit 5aea817801482336ac433a2110c29eacce2fc331
8 changes: 7 additions & 1 deletion scripts/changetool/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,15 @@ function usage(): number {
}

function validate(paths: string[]): number {
let valid = true;
if (paths.length === 0) {
console.error("error: no paths provided (see 'help' command for usage)");
return 1;
}
return paths.every((path) => isValidChangenoteFile(path)) ? 0 : 1;
for (const path of paths) {
if (!isValidChangenoteFile(path)) {
valid = false;
}
}
return valid ? 0 : 1;
}