npm install scino_Format numbers in scientific notation._
``shell`
npm install scino --save
Simply require scino in your program:
`js`
var scino = require('scino')
(You’ll need to use a module bundler like browserify to use scino in a browser.)
Scino is a function that has three parameters:
* num : Number to convert to scientific notationprecision
* : Optional precision to apply to the floatoptions
*
At its most basic, scino formats numbers:
`js`
var formatted = scino(0.0012345)
console.log(formatted) // => '1.2345 × 10⁻³'
The numbers’ precision can be easily adjusted:
`js`
var formatted = scino(0.00051927528, 4)
console.log(formatted) // => '5.193 × 10⁻⁴'
Formatting options are also available:
`js``
var formatted = scino(-1234.56, {
beforeCoefficient: '',
afterCoefficient: '',
multiplicationSign: '✖︎',
beforeExponent: '',
afterExponent: ''
})
console.log(formatted) // => '-1.23456 ✖︎ 10³'
MIT. See LICENSE for details.