diff options
| author | Leyla Jähnig <[email protected]> | 2022-11-25 16:59:10 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-11-25 16:59:10 +0100 |
| commit | 7d4d99f00bf1e29c14346bd6a9fab33c8e7d5743 (patch) | |
| tree | 323754ca575c56ccf688539cfcca66d54c903602 /src/modules/string | |
| parent | 0af0fff4a410d7531368c709327ba0798a47091a (diff) | |
| download | faker-7d4d99f00bf1e29c14346bd6a9fab33c8e7d5743.tar.xz faker-7d4d99f00bf1e29c14346bd6a9fab33c8e7d5743.zip | |
feat(number): move methods to new module (#1122)
Co-authored-by: ST-DDT <[email protected]>
Co-authored-by: Eric Cheng <[email protected]>
Co-authored-by: Leyla Jähnig <[email protected]>
Co-authored-by: Shinigami92 <[email protected]>
Diffstat (limited to 'src/modules/string')
| -rw-r--r-- | src/modules/string/index.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/modules/string/index.ts b/src/modules/string/index.ts index f1a13c1d..de1ec446 100644 --- a/src/modules/string/index.ts +++ b/src/modules/string/index.ts @@ -79,7 +79,7 @@ export type NumericChar = export type AlphaChar = LowerAlphaChar | UpperAlphaChar; export type AlphaNumericChar = AlphaChar | NumericChar; -const SAMPLE_MAX_LENGTH = Math.pow(2, 20); +const SAMPLE_MAX_LENGTH = 2 ** 20; /** * Module to generate string related entries. @@ -416,7 +416,7 @@ export class StringModule { while (returnString.length < length) { returnString += String.fromCharCode( - this.faker.datatype.number(charCodeOption) + this.faker.number.int(charCodeOption) ); } @@ -434,7 +434,7 @@ export class StringModule { uuid(): string { const RFC4122_TEMPLATE = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'; const replacePlaceholders = (placeholder: string) => { - const random = this.faker.datatype.number({ min: 0, max: 15 }); + const random = this.faker.number.int(15); const value = placeholder === 'x' ? random : (random & 0x3) | 0x8; return value.toString(16); }; |
