@techmely/utils
Version:
Collection of helpful JavaScript / TypeScript utils
16 lines (12 loc) • 369 B
JavaScript
/*!
* @techmely/utils
* Copyright(c) 2021-2024 Techmely <techmely.creation@gmail.com>
* MIT Licensed
*/
// src/numberDigitLengthPrecision.ts
function digitLengthPrecision(num) {
const eSplit = num.toString().split(/[eE]/);
const len = (eSplit[0].split(".")[1] || "").length - +(eSplit[1] || 0);
return len > 0 ? len : 0;
}
export { digitLengthPrecision };