price-parser
v3.4.0
Published
Parse { value: number, currencyCode: string } from string
Downloads
638
Maintainers
Keywords
Readme
const priceParser = require('price-parser');
priceParser.parseFirst('31 june: only £ 54 each — 1 time offer!');
// { value: 5400, floatValue: 54, symbol: '£', currencyCode: 'gbp' }
// Note: values are in smallest currency unit
priceParser.parseAll('Was £5.99, now £2.99',);
// [
// { value: 599, floatValue: 5.99, symbol: '£', currencyCode: 'gbp' },
// { value: 299, floatValue: 2.99, symbol: '£', currencyCode: 'gbp' },
// ]