UNPKG

format-money-js

Version:

Zero dependency tiny JavaScript library (1kB bytes) by CurrencyRate.today, providing simple way and advanced number, money and currency formatting and removes all formatting/cruft and returns the raw float value.

15 lines (11 loc) 500 B
const test = require('tape'); const { FormatMoney } = require('./dist/format-money'); const fm1 = new FormatMoney(); test('FormatMoney(): valid params', (t) => { t.equal(1000, fm1.un('1,000', {}), 'should return 1000'); t.equal(1000, fm1.un('1,000.00', {}), 'should return 1000'); t.equal(1000000, fm1.un('1,000,000.00', {}), 'should return 1000000'); t.equal(1, fm1.un('1.000.000.00', {}), 'should return 1'); t.equal(12345, fm1.un('12345.', {}), 'should return 12345'); t.end(); });