JSPM

@strong-roots-capital/get-precision

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q30072F
  • License ISC

Count the number of digits to the right of a decimal

Package Exports

  • @strong-roots-capital/get-precision

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@strong-roots-capital/get-precision) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

get-precision Build status npm version codecov

Count the number of digits to the right of a decimal

This package exists to improve on its predecessors with

  • strong typing
  • support for scientific notation

Install

npm install @strong-roots-capital/get-precision

Use

import getPrecision from '@strong-roots-capital/get-precision'

console.log(getPrecision(0.5))
//=>1

console.log(getPrecision(0.05))
//=>2

console.log(getPrecision(0.00001))
//=>5

console.log(getPrecision(0.00000001))
//=>8

console.log(getPrecision(1.003530591958679e-10))
//=>25

Acknowledgments