@xylabs/decimal-precision
Advanced tools
Comparing version 2.11.3 to 2.11.4
@@ -1,13 +0,38 @@ | ||
'use strict'; | ||
"use strict"; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
const toDecimalPrecision = (value, digits) => { | ||
let fixed = 0; | ||
const result = parseFloat(value.toPrecision(digits)); | ||
while (parseFloat(result.toFixed(fixed)) !== result && fixed < 20) { | ||
fixed++; | ||
} | ||
return result.toFixed(fixed); | ||
// src/index.ts | ||
var src_exports = {}; | ||
__export(src_exports, { | ||
toDecimalPrecision: () => toDecimalPrecision | ||
}); | ||
module.exports = __toCommonJS(src_exports); | ||
var toDecimalPrecision = (value, digits) => { | ||
let fixed = 0; | ||
const result = parseFloat(value.toPrecision(digits)); | ||
while (parseFloat(result.toFixed(fixed)) !== result && fixed < 20) { | ||
fixed++; | ||
} | ||
return result.toFixed(fixed); | ||
}; | ||
exports.toDecimalPrecision = toDecimalPrecision; | ||
//# sourceMappingURL=index.js.map | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
toDecimalPrecision | ||
}); | ||
//# sourceMappingURL=index.js.map |
@@ -42,4 +42,4 @@ { | ||
"devDependencies": { | ||
"@xylabs/ts-scripts-yarn3": "^3.0.0", | ||
"@xylabs/tsconfig": "^3.0.0", | ||
"@xylabs/ts-scripts-yarn3": "^3.0.20", | ||
"@xylabs/tsconfig": "^3.0.20", | ||
"typescript": "^5.2.2" | ||
@@ -55,3 +55,3 @@ }, | ||
"sideEffects": false, | ||
"version": "2.11.3" | ||
"version": "2.11.4" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14844
57