bitburner-src/src/Script/isScriptFilename.ts
Dan b2add6c26b
fix(commands): error feedback, wording consistency
Found most (hopefully all) places where the error message wording
incorrectly was shown to the tune of 'no script exists', where it should
have been showing to the effect of 'script is not running'.
Also cleaned up some of the consistency in the wording and added a
'helper' export for knowing valid script extensions used in validation
of 'isScriptFilename', so we can have consistent error messaging.

Resolves danielyxie/bitburner#1966
2021-12-19 03:10:43 +00:00

6 lines
200 B
TypeScript

export const validScriptExtensions: Array<string> = [`.js`, `.script`, `.ns`];
export function isScriptFilename(f: string): boolean {
return validScriptExtensions.some((ext) => f.endsWith(ext));
}