Package Exports
- format-message-parse
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 (format-message-parse) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Parse ICU message strings to a compact ast
Turns a ICU Message Format string:
`You have {
numBananas, plural,
=0 {no bananas}
one {a banana}
other {# bananas}
} for sale`
into a compact format-message ast:
[ "You have ", [ "numBananas", "plural", 0, {
"=0": [ "no bananas" ],
"one": [ "a banana" ],
"other": [ [ '#' ], " bananas" ]
} ], " for sale." ]
Quick Examples
npm install format-message-parse --save
import parse from 'format-message-parse'
import interpret from 'format-message-interpret'
interpret('en', parse('Hello, {name}!'))({ name: 'Jane' })
API
parse(pattern)
Generate an ast from a string pattern
License
This software is free to use under the MIT license. See the LICENSE-MIT file for license text and copyright information.