JSPM

  • Created
  • Published
  • Downloads 204621
  • Score
    100M100P100Q20576F
  • License MIT

Ponyfill for intl unified numberformat proposal

Package Exports

  • @formatjs/intl-unified-numberformat

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 (@formatjs/intl-unified-numberformat) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

intl-unified-numberformat

A ponyfill for intl-unified-numberformat. This wraps Intl.NumberFormat and has the exact same APIs.

Installation

npm install @formatjs/intl-unified-numberformat

Requirements

This package requires the following capabilities:

Usage

To use the ponyfill, import it along with its data:

import {UnifiedNumberFormat} from '@formatjs/intl-unified-numberformat'
UnifiedNumberFormat.__addUnitLocaleData(
  'bit',
  ...require('../dist/locale-data/bit/zh') // locale-data for zh for unit `bit`
);
UnifiedNumberFormat.__addUnitLocaleData(
  'bit',
  ...require('../dist/locale-data/bit/en')  // locale-data for zh for unit `bit`
);

new UnifiedNumberFormat('zh', {
    style: 'unit',
    unit: 'bit',
    unitDisplay: 'long'
}).format(1000) // 1,000比特