adamwdraper /Numeral-js

A javascript library for formatting and manipulating numbers.

★ 9,693⑂ 908👁 141⑃ 416● 383▤ 10
JavaScriptMITCreated 2012-10-01numeraljs.com
Download: 2.0.62.0.6 ↓2.0.62017-03-27
+0
Daily
9,693
stars
908
forks
141
watchers
416
prs
383
issues
10
releases

README

Numeral.js

A javascript library for formatting and manipulating numbers.

Website and documentation


 Travis Build Status

Master 

Develop 

 NPM



CDNJS



 Contributing

 Important: Please create your branch from and submit pull requests to the develop branch.  All pull requests must include the appropriate tests.

1. Fork the library

2. Install grunt

3. Run npm install to install dependencies

4. Create a new branch from develop

5. Add your tests to the files in /tests

6. To test your tests, run grunt

7. When all your tests are passing, run grunt dist to compile and minify all files

8. Submit a pull request to the develop branch.


 Formats

Formats now exist in their own files and act more or less as plugins. Check out the bytes format for an example of how to create one.


 Locales

When naming locale files use the ISO 639-1 language codes supplemented by ISO 3166-1 country codes when necessary.

 Locale translations will not be merged without unit tests.

See the english unit tests for an example.


 Changelog

 2.0.6

Bug fix: Multi letter currency symbols and spacing

Added: Formatting of numbers with leading zeros

New format: Basic Point

Option: Added scalePercentBy100 (default: true) option to turn on/off scaling percentages

 2.0.4

Bug fix: Incorrect abbreviations for values rounded up 187

Bug fix: Signed currency is inconsistent 89

 2.0.2

Bug fix: Updated module definitions

 2.0.1

Bug fix: Fixed regression for webpack/browserify/rollup

 2.0.0

2.0.0 brings a lot of breaking changes and a reorganization of the repo, but also simplifies the api as well as the creating of custom formats.

Breaking change / Feature: All formats are now separate files.  This makes it easy to create custom formats, and will also allow for custom builds with only certain formats.  (Note: The built numeral.js still contains all formats in the repo).

Breaking change / Feature: All formats and locales are now loaded using numeral.register(type, name, {})

Breaking change: All language now renamed to locale and standardized to all lowercase filenames

Breaking change: The locale function no longer loads locales, it only sets the current locale

Breaking change: The unformat function has been removed numeral().unformat(string) and now happens on numeral init numeral(string)

Breaking change / Feature: Bytes are now formatted as: b (base 1000)  and ib (base 1024)

Breaking change: numeral(NaN) is now treated the same as numeral(null) and no longer throws an error

Feature: Exponential format using e+ or e-

Bug fix: Update to floating point helpers (Note: Numeral does not fix JS floating point errors, but look to our tests to see that it covers quite a few cases.)

 1.5.6

Bug fix: numeral converts strings to numbers

Bug fix: Null values return same as 0

 1.5.5

Contained breaking changes, recommended to use 1.5.6

Bug fix: Switch bytes back to b and change iecBinary to ib, and calculate both using 1024 for backwards compatibility

 1.5.4

Co

Top issues

Latest release

2.0.6 2.0.6 2017-03-27

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON