What is numbro?
Numbro is a JavaScript library for formatting and manipulating numbers. It provides a wide range of functionalities including number formatting, currency formatting, and parsing numbers from strings.
What are numbro's main functionalities?
Number Formatting
This feature allows you to format numbers with various options such as decimal places, thousand separators, and more.
const numbro = require('numbro');
console.log(numbro(1000.234).format('0,0.00')); // '1,000.23'
Currency Formatting
This feature allows you to format numbers as currencies, including options for thousand separators and decimal places.
const numbro = require('numbro');
console.log(numbro(1000.234).formatCurrency({ thousandSeparated: true, mantissa: 2 })); // '$1,000.23'
Parsing Numbers
This feature allows you to parse formatted number strings back into JavaScript numbers.
const numbro = require('numbro');
console.log(numbro().unformat('1,000.23')); // 1000.23
Other packages similar to numbro
numeral
Numeral.js is a library for formatting and manipulating numbers. It offers similar functionalities to numbro, such as number formatting, currency formatting, and parsing. However, numbro provides additional features like locale support and more advanced formatting options.
accounting
Accounting.js is a lightweight JavaScript library for number, money, and currency formatting. While it offers basic formatting functionalities similar to numbro, it lacks some of the advanced features and flexibility that numbro provides.
currency.js
Currency.js is a library focused on handling and formatting currency values. It provides a more specialized set of features for currency manipulation compared to numbro, which offers a broader range of number formatting options.
A javascript library for formatting and manipulating numbers.
Website and documentation
Travis Build Status
Master
Develop
NPM
Contributing
See the CONTRIBUTING.md
file for contribution information.
Languages
Language tags follow the BCP 47 specification.
Language translations will not be merged without unit tests.
See the english unit tests for an example.
Changelog
See CHANGELOG.md. For the original project (Numeral.js) changelog, see CHANGELOG-Numeraljs.md.
Acknowledgements
numbro
is forked from Adam Draper's project
Numeral.js, which was in turn inspired by and heavily borrowed from
Moment.js.
License
Copyright © 2017-2019 Benjamin Van Ryseghem
Copyright © 2015-2017 Företagsplatsen AB
Copyright © 2014 Adam Draper
Distributed under the MIT license. If you want to know more, see the LICENSE
file.
The original license file for Numeral.js
can be found in LICENSE-Numeraljs
Contributors ✨
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
Funding
If you want to give me a hand, you can consider buying me a ko-fi, or becoming a sponsor.