diff options
| author | Shinigami <[email protected]> | 2022-12-09 09:12:29 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-12-09 09:12:29 +0100 |
| commit | 671631b0efa84ec4ff17827c7263a261de2d3fa0 (patch) | |
| tree | b2c0ed235d657f864e842082822937374657fc5a /src/modules/color | |
| parent | 6baa8ceebe63c716a62903f4c8ddaddb799aecdc (diff) | |
| download | faker-671631b0efa84ec4ff17827c7263a261de2d3fa0.tar.xz faker-671631b0efa84ec4ff17827c7263a261de2d3fa0.zip | |
feat(number)!: change float default params (#1642)
Diffstat (limited to 'src/modules/color')
| -rw-r--r-- | src/modules/color/index.ts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/modules/color/index.ts b/src/modules/color/index.ts index 11ebdcd9..167fc225 100644 --- a/src/modules/color/index.ts +++ b/src/modules/color/index.ts @@ -322,7 +322,7 @@ export class ColorModule { } color = Array.from({ length: 3 }, () => this.faker.number.int(255)); if (includeAlpha) { - color.push(this.faker.number.float({ max: 1, precision: 0.01 })); + color.push(this.faker.number.float()); cssFunction = 'rgba'; } return toColorFormat(color, format, cssFunction); @@ -381,7 +381,7 @@ export class ColorModule { cmyk(options?: { format?: ColorFormat }): string | number[]; cmyk(options?: { format?: ColorFormat }): string | number[] { const color: string | number[] = Array.from({ length: 4 }, () => - this.faker.number.float({ max: 1, precision: 0.01 }) + this.faker.number.float() ); return toColorFormat(color, options?.format || 'decimal', 'cmyk'); } @@ -458,7 +458,7 @@ export class ColorModule { }): string | number[] { const hsl: number[] = [this.faker.number.int(360)]; for (let i = 0; i < (options?.includeAlpha ? 3 : 2); i++) { - hsl.push(this.faker.number.float({ max: 1, precision: 0.01 })); + hsl.push(this.faker.number.float()); } return toColorFormat( hsl, @@ -535,7 +535,7 @@ export class ColorModule { hwb(options?: { format?: ColorFormat }): string | number[] { const hsl: number[] = [this.faker.number.int(360)]; for (let i = 0; i < 2; i++) { - hsl.push(this.faker.number.float({ max: 1, precision: 0.01 })); + hsl.push(this.faker.number.float()); } return toColorFormat(hsl, options?.format || 'decimal', 'hwb'); } @@ -592,7 +592,7 @@ export class ColorModule { */ lab(options?: { format?: ColorFormat }): string | number[]; lab(options?: { format?: ColorFormat }): string | number[] { - const lab = [this.faker.number.float({ max: 1, precision: 0.000001 })]; + const lab = [this.faker.number.float({ precision: 0.000001 })]; for (let i = 0; i < 2; i++) { lab.push( this.faker.number.float({ min: -100, max: 100, precision: 0.0001 }) @@ -665,7 +665,7 @@ export class ColorModule { */ lch(options?: { format?: ColorFormat }): string | number[]; lch(options?: { format?: ColorFormat }): string | number[] { - const lch = [this.faker.number.float({ max: 1, precision: 0.000001 })]; + const lch = [this.faker.number.float({ precision: 0.000001 })]; for (let i = 0; i < 2; i++) { lch.push(this.faker.number.float({ max: 230, precision: 0.1 })); } @@ -743,7 +743,7 @@ export class ColorModule { options = { ...options, space: 'sRGB' }; } const color = Array.from({ length: 3 }, () => - this.faker.number.float({ max: 1, precision: 0.0001 }) + this.faker.number.float({ precision: 0.0001 }) ); return toColorFormat( color, |
