From 7d4d99f00bf1e29c14346bd6a9fab33c8e7d5743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leyla=20J=C3=A4hnig?= Date: Fri, 25 Nov 2022 16:59:10 +0100 Subject: feat(number): move methods to new module (#1122) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: ST-DDT Co-authored-by: Eric Cheng Co-authored-by: Leyla Jähnig Co-authored-by: Shinigami92 --- src/modules/string/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/modules/string') 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); }; -- cgit v1.2.3