Skip to content

tpkn/chopnum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Chopnum npm Package

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

About

Beautify long number

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published