# format-message-generate-id

> Generate a message id from the default message pattern

Latest version **6.2.4** (published 2022-02-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install format-message-generate-id
pnpm add format-message-generate-id
yarn add format-message-generate-id
bun add format-message-generate-id
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 6.2.4 |
| Published | 2022-02-17 |
| First published | 2015-11-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 4.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 206 |
| Author | Andy VanWagoner |
| Maintainers | thetalecrafter, bjohn465, aaronshaf, brentburgoyne |
| Keywords | format-message |

## Links

- npm: https://www.npmjs.com/package/format-message-generate-id
- Repository: https://github.com/format-message/format-message
- Homepage: https://github.com/format-message/format-message/tree/master/packages/format-message-generate-id
- Issues: https://github.com/format-message/format-message/issues
- npm.io page: https://npm.io/package/format-message-generate-id

## Dependencies (3)

- [crc32](https://npm.io/package/crc32.md) ^0.2.2
- [format-message-parse](https://npm.io/package/format-message-parse.md) ^6.2.4
- [format-message-print](https://npm.io/package/format-message-print.md) ^6.2.4

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 6.2.4 (latest) — 2022-02-17
- 6.0.0-alpha.2 (next) — 2018-04-18
- 6.2.3 — 2019-07-04
- 6.2.2 — 2019-07-04
- 6.2.0 — 2018-09-12
- 6.1.0 — 2018-08-30
- 6.0.4 — 2018-06-05
- 6.0.3 — 2018-04-27
- 6.0.2 — 2018-04-23
- 6.0.0 — 2018-04-19
- 6.0.0-alpha.1 — 2018-04-17
- 6.0.0-alpha.0 — 2018-04-16
- 5.2.1 — 2017-11-03
- 5.1.2 — 2017-03-23
- 5.1.0 — 2016-12-28
- … 6 more at https://npm.io/package/format-message-generate-id/versions

## README

# ![format-message-generate-id][logo]

> Generate a message id from the default message pattern

[![npm Version][npm-image]][npm]
[![JS Standard Style][style-image]][style]
[![MIT License][license-image]][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`

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

```js
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][LICENSE] for license text and copyright information.


[logo]: https://format-message.github.io/format-message/logo.svg
[npm]: https://www.npmjs.org/package/format-message-generate-id
[npm-image]: https://img.shields.io/npm/v/format-message-generate-id.svg
[style]: https://github.com/feross/standard
[style-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
[license-image]: https://img.shields.io/npm/l/format-message.svg
[LICENSE]: https://github.com/format-message/format-message/blob/master/LICENSE-MIT

---
_Source: https://npm.io/package/format-message-generate-id · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
