parse-money
Extract money from text (number and currency detection)
Returns the amount as Number
and the currency as string
from a text that contains money.
Installation
npm install --save parse-moneyyarn add parse-money
Usage
Pass a string to extract money from.
; // => { amount: 1234.56, currency: 'EUR' } // => { amount: 1234.56, currency: 'USD' } // => { amount: 1234.56, currency: 'USD' } // => { amount: 1234.56, currency: 'USD' } // => { amount: 1234.56, currency: 'GBP' } // => { amount: 1234.56, currency: 'BRL' } // => { amount: 1234.56, currency: 'RUB' } // => { amount: 1234.56, currency: 'ILS' } // => { amount: 123456.78, currency: 'RON' } // => { amount: 123.45, currency: 'RON' } // => { amount: 123.45, currency: 'RON' }
Typings
;
GitHub @mindtricksdev · Twitter @mindtricksdev