format-message-print
TypeScript icon, indicating that this package has built-in type declarations

6.2.4 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i format-message-print

Weekly Downloads

4,449

Version

6.2.4

License

MIT

Unpacked Size

5.02 kB

Total Files

4

Last publish

Collaborators

  • thetalecrafter
  • bjohn465
  • aaronshaf
  • brentburgoyne