aboutsummaryrefslogtreecommitdiff
path: root/src/modules/color
diff options
context:
space:
mode:
authorDivisionByZero <[email protected]>2023-12-30 13:19:29 +0100
committerGitHub <[email protected]>2023-12-30 12:19:29 +0000
commit87e0490978ae4fd2a7ca9aab550a475add513ef6 (patch)
tree84922009f0d5eb8e998c2bb72698018e049eba07 /src/modules/color
parentc10899b638ae36c09833d4de8d79dd3958d58e5a (diff)
downloadfaker-87e0490978ae4fd2a7ca9aab550a475add513ef6.tar.xz
faker-87e0490978ae4fd2a7ca9aab550a475add513ef6.zip
refactor(number): deprecate precision in favor of multipleOf in float (#2564)
Diffstat (limited to 'src/modules/color')
-rw-r--r--src/modules/color/index.ts18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/modules/color/index.ts b/src/modules/color/index.ts
index 57b906a3..a9b39377 100644
--- a/src/modules/color/index.ts
+++ b/src/modules/color/index.ts
@@ -389,7 +389,7 @@ export class ColorModule extends ModuleBase {
color = Array.from({ length: 3 }, () => this.faker.number.int(255));
if (includeAlpha) {
- color.push(this.faker.number.float({ precision: 0.01 }));
+ color.push(this.faker.number.float({ multipleOf: 0.01 }));
cssFunction = 'rgba';
}
@@ -470,7 +470,7 @@ export class ColorModule extends ModuleBase {
}): string | number[];
cmyk(options?: { format?: ColorFormat }): string | number[] {
const color: string | number[] = Array.from({ length: 4 }, () =>
- this.faker.number.float({ precision: 0.01 })
+ this.faker.number.float({ multipleOf: 0.01 })
);
return toColorFormat(color, options?.format || 'decimal', 'cmyk');
}
@@ -580,7 +580,7 @@ export class ColorModule extends ModuleBase {
}): 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({ precision: 0.01 }));
+ hsl.push(this.faker.number.float({ multipleOf: 0.01 }));
}
return toColorFormat(
@@ -686,7 +686,7 @@ export class ColorModule extends ModuleBase {
}): string | number[] {
const hsl: number[] = [this.faker.number.int(360)];
for (let i = 0; i < 2; i++) {
- hsl.push(this.faker.number.float({ precision: 0.01 }));
+ hsl.push(this.faker.number.float({ multipleOf: 0.01 }));
}
return toColorFormat(hsl, options?.format || 'decimal', 'hwb');
@@ -765,10 +765,10 @@ export class ColorModule extends ModuleBase {
format?: ColorFormat;
}): string | number[];
lab(options?: { format?: ColorFormat }): string | number[] {
- const lab = [this.faker.number.float({ precision: 0.000001 })];
+ const lab = [this.faker.number.float({ multipleOf: 0.000001 })];
for (let i = 0; i < 2; i++) {
lab.push(
- this.faker.number.float({ min: -100, max: 100, precision: 0.0001 })
+ this.faker.number.float({ min: -100, max: 100, multipleOf: 0.0001 })
);
}
@@ -860,9 +860,9 @@ export class ColorModule extends ModuleBase {
format?: ColorFormat;
}): string | number[];
lch(options?: { format?: ColorFormat }): string | number[] {
- const lch = [this.faker.number.float({ precision: 0.000001 })];
+ const lch = [this.faker.number.float({ multipleOf: 0.000001 })];
for (let i = 0; i < 2; i++) {
- lch.push(this.faker.number.float({ max: 230, precision: 0.1 }));
+ lch.push(this.faker.number.float({ max: 230, multipleOf: 0.1 }));
}
return toColorFormat(lch, options?.format || 'decimal', 'lch');
@@ -970,7 +970,7 @@ export class ColorModule extends ModuleBase {
}
const color = Array.from({ length: 3 }, () =>
- this.faker.number.float({ precision: 0.0001 })
+ this.faker.number.float({ multipleOf: 0.0001 })
);
return toColorFormat(
color,