UNPKG

@techmely/utils

Version:

Collection of helpful JavaScript / TypeScript utils

18 lines (13 loc) 404 B
'use strict'; /*! * @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; } exports.digitLengthPrecision = digitLengthPrecision;