MCPcopy
hub / github.com/faker-js/faker / precision

Function precision

test/modules/location.spec.ts:29–36  ·  view source on GitHub ↗

* Returns the number of decimal places a number has. * * @param num The number to check.

(num: number)

Source from the content-addressed store, hash-verified

27 * @param num The number to check.
28 */
29function precision(num: number): number {
30 const decimalPart = num.toString().split('.', 2)[1];
31 if (decimalPart === undefined) {
32 return 0;
33 }
34
35 return decimalPart.length;
36}
37
38// https://nssdc.gsfc.nasa.gov/planetary/factsheet/earthfact.html
39const EQUATORIAL_EARTH_RADIUS = 6378.137;

Callers 1

location.spec.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected