diff options
| author | DivisionByZero <[email protected]> | 2024-01-18 17:14:48 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-01-18 17:14:48 +0100 |
| commit | 41d87789c7ff353acfd0f5ca88a99c0d1fd3b500 (patch) | |
| tree | 28d5a0a2e72881ed0202e2b2c86a4fb3b590e69d /src/modules/location | |
| parent | d71bc47a4a7b127b41068016cbed3584a35b47ea (diff) | |
| download | faker-41d87789c7ff353acfd0f5ca88a99c0d1fd3b500.tar.xz faker-41d87789c7ff353acfd0f5ca88a99c0d1fd3b500.zip | |
feat(number): add parameter `fractionDigits` in float (#1855)
Co-authored-by: ST-DDT <[email protected]>
Diffstat (limited to 'src/modules/location')
| -rw-r--r-- | src/modules/location/index.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/modules/location/index.ts b/src/modules/location/index.ts index b06af49e..608e65a6 100644 --- a/src/modules/location/index.ts +++ b/src/modules/location/index.ts @@ -579,7 +579,7 @@ export class LocationModule extends ModuleBase { const { max = 90, min = legacyMin, precision = legacyPrecision } = options; - return this.faker.number.float({ min, max, multipleOf: 10 ** -precision }); + return this.faker.number.float({ min, max, fractionDigits: precision }); } /** @@ -732,7 +732,7 @@ export class LocationModule extends ModuleBase { const { max = 180, min = legacyMin, precision = legacyPrecision } = options; - return this.faker.number.float({ max, min, multipleOf: 10 ** -precision }); + return this.faker.number.float({ max, min, fractionDigits: precision }); } /** @@ -1207,7 +1207,7 @@ export class LocationModule extends ModuleBase { const angleRadians = this.faker.number.float({ max: 2 * Math.PI, - multipleOf: 0.00001, + fractionDigits: 5, }); // in ° radians const radiusMetric = isMetric ? radius : radius * 1.60934; // in km @@ -1215,7 +1215,7 @@ export class LocationModule extends ModuleBase { const distanceInKm = this.faker.number.float({ max: radiusMetric, - multipleOf: 0.001, + fractionDigits: 3, }) * errorCorrection; // in km /** |
