diff options
| author | Shinigami <[email protected]> | 2023-10-17 22:03:32 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-10-17 20:03:32 +0000 |
| commit | c0330442be99988db57e9dad12ebdcd3b3a92213 (patch) | |
| tree | 49a7814ef2a3b3a05b147e8be790c4712ef414e8 /src/modules/string | |
| parent | f3de0f61dc517a4548150fd40498a9df6d4b97e6 (diff) | |
| download | faker-c0330442be99988db57e9dad12ebdcd3b3a92213.tar.xz faker-c0330442be99988db57e9dad12ebdcd3b3a92213.zip | |
infra(unicorn): prefer-spread (#2421)
Co-authored-by: ST-DDT <[email protected]>
Diffstat (limited to 'src/modules/string')
| -rw-r--r-- | src/modules/string/index.ts | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/modules/string/index.ts b/src/modules/string/index.ts index 8167ebea..a370c386 100644 --- a/src/modules/string/index.ts +++ b/src/modules/string/index.ts @@ -5,13 +5,9 @@ import type { LiteralUnion } from '../../utils/types'; export type Casing = 'upper' | 'lower' | 'mixed'; -const UPPER_CHARS: ReadonlyArray<string> = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split( - '' -); -const LOWER_CHARS: ReadonlyArray<string> = 'abcdefghijklmnopqrstuvwxyz'.split( - '' -); -const DIGIT_CHARS: ReadonlyArray<string> = '0123456789'.split(''); +const UPPER_CHARS: ReadonlyArray<string> = [...'ABCDEFGHIJKLMNOPQRSTUVWXYZ']; +const LOWER_CHARS: ReadonlyArray<string> = [...'abcdefghijklmnopqrstuvwxyz']; +const DIGIT_CHARS: ReadonlyArray<string> = [...'0123456789']; export type LowerAlphaChar = | 'a' @@ -145,7 +141,7 @@ export class StringModule { } if (typeof characters === 'string') { - characters = characters.split(''); + characters = [...characters]; } if (characters.length === 0) { @@ -229,7 +225,7 @@ export class StringModule { let { exclude = [] } = options; if (typeof exclude === 'string') { - exclude = exclude.split(''); + exclude = [...exclude]; } let charsArray: string[]; @@ -319,7 +315,7 @@ export class StringModule { let { exclude = [] } = options; if (typeof exclude === 'string') { - exclude = exclude.split(''); + exclude = [...exclude]; } let charsArray = [...DIGIT_CHARS]; @@ -596,7 +592,7 @@ export class StringModule { let { exclude = [] } = options; if (typeof exclude === 'string') { - exclude = exclude.split(''); + exclude = [...exclude]; } const allowedDigits = DIGIT_CHARS.filter( |
