npm.io
1.0.1 • Published 8 years ago

usd-formatter

Licence
MIT
Version
1.0.1
Deps
1
Size
247 kB
Vulns
0
Weekly
0

USD Formatter

Lightweight number to currency formatter. Accepts any kind of string or number and formats it to a USD string.

Installation

$ npm i -S usd-formatter

Usage

const formatter = require('usd-formatter')

let currency = formatter(12345678.9)
console.log(currency)

// Logs "$12,345,678.90"

Options

The following options can be passed for the second argument.

formatter(12345678.9, {
	prepend: '
,
})

Keywords