accounting vs currency.js vs format-number vs intl vs numbro vs numeral
JavaScript Libraries for Number Formatting and Currency Management
accountingcurrency.jsformat-numberintlnumbronumeralSimilar Packages:

JavaScript Libraries for Number Formatting and Currency Management

These libraries provide various functionalities for formatting numbers, currencies, and handling internationalization in JavaScript applications. They simplify the process of displaying numbers and currencies in a user-friendly way, ensuring that developers can easily manage localization and formatting according to different regional standards. Each library has its unique features and use cases, catering to different needs in web development.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
accounting04,990-14512 years ago-
currency.js03,368-585 years agoMIT
format-number051-69 years agoBSD-3-Clause
intl01,693-7910 years agoMIT
numbro01,1401.27 MB2702 years agoMIT
numeral09,715-3499 years agoMIT

Feature Comparison: accounting vs currency.js vs format-number vs intl vs numbro vs numeral

Core Functionality

  • accounting:

    accounting.js focuses on financial calculations and currency formatting, providing functions for currency formatting, number formatting, and basic arithmetic operations. It is designed to handle monetary values effectively.

  • currency.js:

    currency.js specializes in currency manipulation, offering features like currency conversion, formatting, and arithmetic operations with precision. It supports multiple currencies and is tailored for financial applications.

  • format-number:

    format-number provides a straightforward approach to number formatting, allowing developers to format numbers with specified decimal places and thousands separators without complex configurations.

  • intl:

    intl offers a comprehensive set of internationalization features, including number formatting, date formatting, and message formatting, making it suitable for applications that require localization across different cultures.

  • numbro:

    numbro provides extensive formatting options for numbers, including custom formats and localization capabilities, allowing developers to format numbers according to specific regional standards.

  • numeral:

    numeral.js offers powerful number formatting capabilities, including currency, percentages, and custom formats, making it versatile for various applications.

Localization Support

  • accounting:

    accounting.js has limited localization support, primarily focusing on US-style formatting. It may require additional handling for internationalization needs.

  • currency.js:

    currency.js supports multiple currencies and allows for easy conversion between them, making it suitable for applications with international financial transactions.

  • format-number:

    format-number provides basic localization options but may not cover all international formatting needs, making it less suitable for global applications.

  • intl:

    intl excels in localization, providing robust support for different locales and formats, making it ideal for applications targeting a diverse audience.

  • numbro:

    numbro offers good localization support, allowing developers to format numbers based on specific locales, enhancing user experience in different regions.

  • numeral:

    numeral.js provides basic localization features but may not be as comprehensive as other libraries for internationalization.

Ease of Use

  • accounting:

    accounting.js is user-friendly and easy to integrate, making it suitable for developers who need quick solutions for financial formatting without complex setups.

  • currency.js:

    currency.js is straightforward to use, with a simple API that allows developers to perform currency operations easily, making it accessible for beginners.

  • format-number:

    format-number is designed for simplicity, making it easy to implement for basic number formatting tasks without additional overhead.

  • intl:

    intl may have a steeper learning curve due to its comprehensive features, but it offers extensive documentation to assist developers in utilizing its capabilities effectively.

  • numbro:

    numbro is relatively easy to use, with a clear API for formatting numbers, making it approachable for developers of all skill levels.

  • numeral:

    numeral.js is user-friendly and provides a simple API for formatting numbers, making it easy to adopt for various applications.

Performance

  • accounting:

    accounting.js is lightweight and performs well for basic formatting tasks, making it suitable for applications where performance is a concern.

  • currency.js:

    currency.js is optimized for performance, especially in applications that require frequent currency calculations and conversions.

  • format-number:

    format-number is efficient for simple number formatting tasks, ensuring minimal overhead in performance-sensitive applications.

  • intl:

    intl may have performance implications due to its comprehensive features, but it is designed to handle a wide range of formatting efficiently.

  • numbro:

    numbro is designed for performance, providing fast formatting options for numbers, making it suitable for applications with high formatting demands.

  • numeral:

    numeral.js performs well for various formatting tasks, but performance may vary depending on the complexity of the formatting required.

Community and Support

  • accounting:

    accounting.js has a smaller community but provides sufficient documentation for basic usage, making it easy to get started.

  • currency.js:

    currency.js has a growing community and offers good documentation, making it easier for developers to find support and resources.

  • format-number:

    format-number has limited community support, but its simplicity means that most developers can quickly understand and implement it without extensive help.

  • intl:

    intl has a large community and extensive documentation, providing ample resources for developers looking to implement internationalization in their applications.

  • numbro:

    numbro has a moderate community and offers decent documentation, making it relatively easy to find help when needed.

  • numeral:

    numeral.js has a strong community and good documentation, providing developers with resources and support for various use cases.

How to Choose: accounting vs currency.js vs format-number vs intl vs numbro vs numeral

  • accounting:

    Choose accounting.js if you need a lightweight library specifically for accounting purposes, such as formatting currency and performing basic arithmetic operations with numbers. It is straightforward and easy to use for financial applications.

  • currency.js:

    Select currency.js if you require a robust solution for currency manipulation, including support for various currencies, precision handling, and built-in methods for common currency operations. It is ideal for applications that need to handle multiple currencies effectively.

  • format-number:

    Opt for format-number if you need a simple and flexible solution for number formatting without additional dependencies. It is useful for straightforward number formatting tasks and works well in smaller projects or where minimalism is preferred.

  • intl:

    Use the intl library if you need comprehensive internationalization support, including number formatting, date and time formatting, and message formatting. It is especially useful for applications targeting a global audience with diverse localization needs.

  • numbro:

    Choose numbro if you want a library that offers extensive formatting options for numbers, including custom formats and localization. It is beneficial for applications that require detailed control over number presentation.

  • numeral:

    Select numeral.js for a versatile library that provides powerful number formatting capabilities, including currency, percentages, and custom formats. It is suitable for applications that need a wide range of formatting options.

README for accounting

accounting.js is a tiny JavaScript library for number, money and currency parsing/formatting. It's lightweight, fully localisable, has no dependencies, and works great client-side or server-side. Use standalone or as a nodeJS/npm and AMD/requireJS module.

Visit the plugin homepage for demos and documentation: http://openexchangerates.github.io/accounting.js/

Please checkout or download the latest stable tag before using in production. Bug reports and pull requests are welcome.

Maintained by Open Exchange Rates and originally by @josscrowcroft and other contributors.


Works great with:

  • money.js - a tiny (1kb) standalone JavaScript currency conversion library, for web & nodeJS
  • Open Exchange Rates - the free currency conversion data API

Changelog

v0.4.1 - Alias accounting.formatNumber() as accounting.format()

v0.4 - Transferred repository to Open Exchange Rates for ongoing maintenance

v0.3.2 - Fixed package.json dependencies (should be empty object)

v0.3.0

  • Rewrote library structure similar to underscore.js for use as a nodeJS/npm and AMD module. Use npm install accounting and then var accounting = require("accounting"); in your nodeJS scripts.
  • Also works with requireJS or any AMD module loader.
  • unformat now only attempts to parse the number if it's not already a valid number.
  • acounting.unformat now also aliased as acounting.parse
  • Fixed an IE bug in the defaults method

v0.2.2 - Fixed same issue as #Num: #24 in formatNumber; switch to Google Closure Compiler for minified version.

v0.2.1 - Fixed issue #Num: #24 (locally-defined settings object was being modified by formatMoney)

v0.2

  • Rewrote formatting system for formatMoney and formatColumn for better control of string output
  • Now supports separate formats for negative and zero values (optionally) via accounting.settings.currency.format
  • Internal improvements and helper methods

v0.1.4

  • formatMoney recursively formats arrays
  • Added Jasmine test suite (thanks to millermedeiros) and QUnit functionality/speed tests

v0.1.3

  • Added configurable settings object for default formatting parameters.
  • Added format parameter to control symbol and value position (default "%s%v", or [symbol][value])
  • Methods consistently accept object as 2nd parameter, matching/overriding the library defaults

v0.1.2

  • formatColumn works recursively on nested arrays (e.g. accounting.formatColumn( [[1,12,123,1234], [1234,123,12,1]] ), returns matching array with inner columns lined up)
  • Fix rounding in formatNumber

v0.1.1

  • Added toFixed method (accounting.toFixed(value, precision)), which treats floats more like decimals for more accurate currency rounding
  • Minified version preserves semicolons
  • Fixed NaN errors when no value in unformat

v0.1 - First version