1.0.2 • Published 5 years ago
chopnum v1.0.2
Chopnum
Beautify long number
API
Chopnum(num[, options])
num
Type: Number
options.step
Type: Number
Default: 3
Chunk length
options.separator
Type: String
Default:
Separate chunks with this symbol
options.round
Type: Boolean
Default: false
Remove fractional part
Usage
Chopnum(12)
// => 12
Chopnum(123456789)
// => '123 456 789'
Chopnum(-123456789)
// => '-123 456 789'
Chopnum(123456789, { step: 4 })
// => '1 2345 6789'
Chopnum(123456789, { separator: '-' })
// => '123-456-789'
Changelog
v1.0.2 (2019-08-29):
- fixed bug when minus sign was perceived as part of a number
1.0.2
5 years ago