A lightweight, zero-dependency JavaScript library for formatting numbers and strings into USD currency strings. Current stable version is 1.0.1, last released in 2018. It accepts any string or number input and outputs a formatted string with a dollar sign, commas, and two decimal places. Options include prepending a symbol (default $). This is a simple, no-frills formatter for basic USD formatting without locale support or advanced configuration.
npm install usd-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic usage: formatting a number to USD string, handling invalid input, and using custom prepend option.
Validate input before formatting if you need to handle errors.
Use Intl.NumberFormat for full locale support.
Manually handle negative signs if needed.
Use import formatter from 'usd-formatter' or const formatter = require('usd-formatter').defaultRun 'npm install usd-formatter' and ensure node_modules contains the package.
No dependency data recorded yet.