A lightweight and fast standalone JavaScript number formatter, version 1.2.0. It supports standard number formatting masks like '#,##0.00', custom grouping and decimal symbols, auto-rounding, and prefix/suffix (with restrictions). The library is less than 1.2 KB minified and has no dependencies. It is available as an npm package and via Bower, with UMD support (AMD, CommonJS, global). Key differentiators: tiny footprint, simple API, and flexible mask syntax. Not intended for scientific notation or date formatting.
npm install number-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage of numberFormatter with different masks: comma grouping, currency, European separators, and rounding.
To force a single symbol as group separator, add a trailing dot: '#,###.'
Use concatenation: '$' + numberFormatter('#,##0.00', val) or numberFormatter('#,##0.00', val) + 'USD'Use npm install instead of bower install
Upgrade to >=1.1.2 which removes negative sign from zero results
Avoid using with very large/small numbers; consider using Number.prototype.toExponential or a dedicated library
Use: const numberFormatter = require('number-formatter');Add trailing dot to force group separator: '#,###.'
Ensure the second argument is a number: use parseFloat or Number conversion first
No dependency data recorded yet.