@techmely/utils
Version:
Collection of helpful JavaScript / TypeScript utils
27 lines (22 loc) • 703 B
JavaScript
/*!
* @techmely/utils
* Copyright(c) 2021-2024 Techmely <techmely.creation@gmail.com>
* MIT Licensed
*/
// src/numberBoundaryStatePrecision.ts
var _boundaryCheckingState = true;
function checkBoundaryPrecision(num) {
if (_boundaryCheckingState) {
if (num > Number.MAX_SAFE_INTEGER || num < Number.MIN_SAFE_INTEGER) {
console.warn(
`${num} is beyond boundary when transfer to integer, the results may not be accurate`
);
}
}
}
function enableBoundaryCheckingPrecision(flag = true) {
_boundaryCheckingState = flag;
}
exports.checkBoundaryPrecision = checkBoundaryPrecision;
exports.enableBoundaryCheckingPrecision = enableBoundaryCheckingPrecision;
;