Package detail

format-message-print

format-message29.2kMIT6.2.4

Pretty print compact message format ast

format-message

readme

format-message-print

Pretty print compact message format ast

npm Version JS Standard Style MIT License

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.