usd-formatter

1.0.1 • Public • Published

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: '$',
})

Package Sidebar

Install

npm i usd-formatter

Weekly Downloads

11

Version

1.0.1

License

MIT

Unpacked Size

253 kB

Total Files

9

Last publish

Collaborators

  • amadoa
  • dalewray
  • codevelopit
  • mastaaaron
  • escasports
  • tbaustin
  • ken85rose