@messageformat/number-skeleton
A parser & formatter for ICU NumberFormat skeleton strings & patterns
Last updated 3 years ago by eemeli .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @messageformat/number-skeleton 
SYNC missed versions from official npm registry.

@messageformat/number-skeleton

Tools for working with ICU NumberFormat skeletons and patterns.

import {
  getNumberFormatter,
  getNumberFormatterSource,
  NumberFormatError,
  parseNumberPattern,
  parseNumberSkeleton,
  Skeleton, // TS only
  Unit // TS only
} from '@messageformat/number-skeleton';

The package is released as an ES module only. If using from a CommonJS context, you may need to import() it, or use a module loader like esm.

Uses Intl.NumberFormat internally, including features provided by the Unified API Proposal.

Classes

Class Description
NumberFormatError Base class for errors. In addition to a code and a human-friendly message, may also includes the token stem as well as other fields.

Functions

Function Description
getNumberFormatter(locales, skeleton, currency, onError) Returns a number formatter function for the given locales and number skeleton
getNumberFormatterSource(locales, skeleton, currency, onError) Returns a string of JavaScript source that evaluates to a number formatter function with the same (value: number) => string signature as the function returned by getNumberFormatter().
parseNumberPattern(src, currency, onError) Parse an ICU NumberFormatter pattern string into a Skeleton structure.
parseNumberSkeleton(src, onError) Parse an ICU NumberFormatter skeleton string into a Skeleton structure.

Interfaces

Interface Description
Skeleton An object representation of a parsed string skeleton, with token values grouped by type.

Type Aliases

Type Alias Description
Unit Measurement units defined by the Unicode CLDR

Messageformat is an OpenJS Foundation project, and we follow its Code of Conduct.

OpenJS Foundation

Current Tags

  • 1.2.0                                ...           latest (3 years ago)

4 Versions

  • 1.2.0                                ...           3 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.0                                ...           5 years ago
  • 1.0.0-beta.1                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 2
This Month 2
Last Day 2
Last Week 1
Last Month 2
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |