-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(cli): renames assertion function
when a function just does an assertion, call it assert, not validate ...
- Loading branch information
Showing
5 changed files
with
20 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/cli/utl/validate-file-existence.mjs → src/cli/utl/assert-file-existence.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { accessSync, R_OK } from "node:fs"; | ||
|
||
export default function validateFileExistence(pDirectoryOrFile) { | ||
export default function assertFileExistence(pDirectoryOrFile) { | ||
try { | ||
accessSync(pDirectoryOrFile, R_OK); | ||
} catch (pError) { | ||
throw new Error( | ||
`Can't open '${pDirectoryOrFile}' for reading. Does it exist?\n` | ||
`Can't open '${pDirectoryOrFile}' for reading. Does it exist?\n`, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../cli/utl/validate-file-existence.spec.mjs → test/cli/utl/assert-file-existence.spec.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters