parse-currency

0.1.0 • Public • Published

parse currency

XO code style

Just a simple function to parse currency values.

install

npm i -S parse-currency

and use it

import parseCurrency from 'parse-currency'
// OR
const parseCurrency = require('parse-currency')
 
const foo = parseCurrency('$10.50')
console.log(foo) // 10.5
 
const bar = parseCurrency('$1,000,000.25')
console.log(bar) // 1000000.25

behavior

  • it only works with USD formated currencies. for now
  • if an empty string or a non-string value is passed, parseCurrency returns null.
  • parseCurrency is a pure function, it does not mutate the provided string.

FAQ

Readme

Keywords

Package Sidebar

Install

npm i parse-currency

Weekly Downloads

21

Version

0.1.0

License

MIT

Last publish

Collaborators

  • gillchristian