format-message-generate-id
Generate a message id from the default message pattern
Last updated a year ago by bjohn465 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install format-message-generate-id 
SYNC missed versions from official npm registry.

format-message-generate-id

Generate a message id from the default message pattern

npm Version JS Standard Style MIT License

A small collection of helper functions for use in format-message, to generate a message id based on the default message pattern.

Quick Examples

npm install format-message-generate-id --save

var formatMessage = require('format-message');
formatMessage.setup({
  generateId: require('format-message-generate-id/underscored_crc32')
});
import formatMessage from 'format-message'
import generate from 'format-message-generate-id'

formatMessage.setup({
  generateId: generate.normalized
})

API

literal(pattern)

Simply returns the pattern passed in.

normalized(pattern)

Normalizes insignificant whitespace within ICU placeholder syntax. This requires parsing and pretty-printing the message pattern, and an invalid message will cause an error to be thrown.

underscored(pattern)

After normalizing the message pattern, a slug is generated with underscores replacing symbols and whitespace.

underscored_crc32(pattern)

In addition to generating a slug, a crc32 checksum is calculated from the normalized pattern and appended to the result.

License

This software is free to use under the MIT license. See the LICENSE-MIT file for license text and copyright information.

Current Tags

  • 6.2.3                                ...           latest (a year ago)
  • 6.0.0-alpha.2                                ...           next (2 years ago)

20 Versions

  • 6.2.3                                ...           a year ago
  • 6.2.2                                ...           a year ago
  • 6.2.0                                ...           2 years ago
  • 6.1.0                                ...           2 years ago
  • 6.0.4                                ...           2 years ago
  • 6.0.3                                ...           2 years ago
  • 6.0.2                                ...           2 years ago
  • 6.0.0                                ...           2 years ago
  • 6.0.0-alpha.2                                ...           2 years ago
  • 6.0.0-alpha.1                                ...           2 years ago
  • 6.0.0-alpha.0                                ...           2 years ago
  • 5.2.1                                ...           3 years ago
  • 5.1.2                                ...           3 years ago
  • 5.1.0                                ...           4 years ago
  • 5.0.0                                ...           4 years ago
  • 5.0.0-beta.10                                ...           4 years ago
  • 5.0.0-beta.9                                ...           4 years ago
  • 5.0.0-beta.8                                ...           4 years ago
  • 4.0.1                                ...           4 years ago
  • 4.0.0                                ...           5 years ago

Copyright 2014 - 2017 © taobao.org |