Newton's Poleless Magnet

    price-extractor
    TypeScript icon, indicating that this package has built-in type declarations

    2.1.0 • Public • Published

    Npm Version node Build Status Test Coverage Maintainability Known Vulnerabilities dependencies Status devDependencies Status

    price-extractor

    A small library for parsing price strings in order to extract the price as a number and the currency code of the price.
    The library can handle all kinds of thousands and cents delimiters, as well as all currency native symbols and unicodes.

    Installation

    npm install price-extractor

    Or

    yarn add price-extractor

    Examples

    import {searchPriceAndCode} from 'price-extractor';
    console.dir(searchPriceAndCode('99,01€')); // { price: 99.01, code: 'EUR' }
    console.dir(searchPriceAndCode('ARS 1,647.86')); // { price: 1647.86, code: 'ARS' }
    console.dir(searchPriceAndCode('1.958,43 NOK')); // { price: 1958.43, code: 'NOK' }
    console.dir(searchPriceAndCode('¥732.62')); // { price: 732.62, code: 'JPY' }
    console.dir(searchPriceAndCode('2\'425.64 CHF')); // { price: 2425.64, code: 'CHF' }

    Install

    npm i price-extractor

    DownloadsWeekly Downloads

    151

    Version

    2.1.0

    License

    GPL-3.0

    Unpacked Size

    79.4 kB

    Total Files

    9

    Last publish

    Collaborators

    • regevbr