Tuesday, November 3, 2015

A javascript library for formatting and manipulating numbers.

Numeral.js, while less complex, was inspired by and heavily borrowed from Moment.js so if you have use momentjs before you should be familiar with this library.

Numbers can be formatted to look like currency, percentages and more.

How to use:
numeral(1000).format('0,0') returns 1,000
numeral(1230974).format('0.0a') returns 1.2m

numeral(1000.234).format('$0,0.00') returns $1,000.23
numeral(1230974).format('($ 0.00 a)') returns $ 1.23 m

numeral(1).format('0%') returns 100%
numeral(0.974878234).format('0.000%') returns 97.488%

For more sample and options go to http://numeraljs.com/.