1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.prettyNumber = exports.clamp = void 0;
|
4 | /**
|
5 | * Clamp number within the inclusive range within the lower and upper bounds.
|
6 | */
|
7 | function clamp(v, lower, upper) {
|
8 | return Math.max(lower, Math.min(v, upper));
|
9 | }
|
10 | exports.clamp = clamp;
|
11 | /**
|
12 | * Precision conversion
|
13 | */
|
14 | function prettyNumber(n, precision = 10) {
|
15 | if (typeof n !== 'number')
|
16 | return n;
|
17 | return Math.abs(n) < 1e-15 ? n : parseFloat(n.toFixed(precision));
|
18 | }
|
19 | exports.prettyNumber = prettyNumber;
|
20 | //# sourceMappingURL=number.js.map |
\ | No newline at end of file |