polyfill-number-tolocalestring

2.0.0 • Public • Published

polyfill-number-tolocalestring

Polyfill Number.prototype.toLocaleString() with globalize and cldr-data.

install

$ yarn add polyfill-number-tolocalestring

usage

import usePolyfill from 'polyfill-number-tolocalestring'
 
async function main() {
  const reset = await usePolyfill(true)
 
  const num = 1200.01
 
  console.log(num.toLocaleString('nl')) // -> 1.200,01
  console.log(num.toLocaleString('nl', {
    style: 'currency',
    currency: 'EUR',
    currencyDisplay: 'code'
  })) // -> 1.200,01 EUR
 
  reset()
 
  console.log(num.toLocaleString('nl')) // -> 1,200.01
}
 
main()

/polyfill-number-tolocalestring/

    Package Sidebar

    Install

    npm i polyfill-number-tolocalestring

    Weekly Downloads

    2

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    672 kB

    Total Files

    9

    Last publish

    Collaborators

    • pimlie