diff options
| author | Shinigami <[email protected]> | 2022-03-25 16:51:36 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-03-25 15:51:36 +0000 |
| commit | a299c22c375538112c52ee0ad69902c87496f78c (patch) | |
| tree | e080dfb6f468a2bb4c6bb28b2442c68865bd2371 /scripts | |
| parent | ba3c62fca76fe2dc9fd1c8c9292c5333bf2c10a7 (diff) | |
| download | faker-a299c22c375538112c52ee0ad69902c87496f78c.tar.xz faker-a299c22c375538112c52ee0ad69902c87496f78c.zip | |
refactor: use smart eqeqeq null checks (#650)
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/apidoc/signature.ts | 5 | ||||
| -rw-r--r-- | scripts/generateLocales.ts | 4 |
2 files changed, 3 insertions, 6 deletions
diff --git a/scripts/apidoc/signature.ts b/scripts/apidoc/signature.ts index 926b5a7c..31674c83 100644 --- a/scripts/apidoc/signature.ts +++ b/scripts/apidoc/signature.ts @@ -226,10 +226,7 @@ function typeToText(type_: Type, short = false): string { .sort() .join(' | '); case 'reference': - if ( - typeof type.typeArguments === 'undefined' || - !type.typeArguments.length - ) { + if (!type.typeArguments || !type.typeArguments.length) { return type.name; } else { return `${type.name}<${type.typeArguments diff --git a/scripts/generateLocales.ts b/scripts/generateLocales.ts index a402bc1e..2167caa9 100644 --- a/scripts/generateLocales.ts +++ b/scripts/generateLocales.ts @@ -60,7 +60,7 @@ function escapeField(module: string): string { } function containsAll(checked?: string[], expected?: string[]): boolean { - if (typeof expected === 'undefined' || typeof checked === 'undefined') { + if (expected == null || checked == null) { return true; } return expected.every((c) => checked.includes(c)); @@ -185,7 +185,7 @@ function generateRecursiveModuleIndexes( // Overwrite types of src/locales/<locale>/<module>/index.ts for known DEFINITIONS if (depth === 1) { moduleFiles = DEFINITIONS[submodule]; - if (typeof moduleFiles === 'undefined') { + if (moduleFiles == null) { moduleDefinition = 'any'; } else { moduleDefinition = `${submodule.replace(/(^|_)([a-z])/g, (s) => |
