const decimalPlaces = number => {
if (number.toString().split(/[\.e]/).length === 1) return 0
let result
// @ts-ignore
number.toString().replace(/[\.e]/, reg => {
switch (reg) {
case '.': {
result = number.toString().split('.')[1].length
return
}
case 'e': {
result = Math.abs(number.toString().split('e')[1])
return
}}})
return result
}
console.log(decimalPlaces(0.000000000000001)) // 15
console.log(decimalPlaces(17.41452)) // 5
console.log(decimalPlaces(10)) // 0