format-message-print
v6.2.4
Published
Pretty print compact message format ast
Downloads
18,848
Keywords
Readme
Pretty print compact message format ast
Turns a compact format-message ast:
[ "You have ", [ "numBananas", "plural", 0, {
"=0": [ "no bananas" ],
"one": [ "a banana" ],
"other": [ [ '#' ], " bananas" ]
} ], " for sale." ]
into a pretty ICU Message Format string:
`You have {
numBananas, plural,
=0 {no bananas}
one {a banana}
other {# bananas}
} for sale`
Quick Examples
npm install format-message-print --save
import parse from 'format-message-parse'
import print from 'format-message-print'
print(parse('Hello, {name}!'))
//-> 'Hello { name }!'
API
print(pattern)
Generate a string from an ast. The output is a canonical version of the pattern.
License
This software is free to use under the MIT license. See the LICENSE-MIT file for license text and copyright information.