mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 09:14:58 +00:00
Replace Array.prototype.every() with for loop
`.every()` short-circuits on the first `false`
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user