Replace Array.prototype.every() with for loop

`.every()` short-circuits on the first `false`
This commit is contained in:
Mario Campos
2026-08-26 22:20:25 -05:00
parent 580da893f6
commit 5aea817801

View File

@@ -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;
}