JSPM

polyfill-number-tolocalestring

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q20235F
  • License MIT

Polyfill Number.prototype.toLocaleString() using globalize

Package Exports

  • polyfill-number-tolocalestring

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (polyfill-number-tolocalestring) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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()