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

1.1.0 • Public • Published

Message Interpolation

The process of formatting messages for internationalization.

Install

$ npm i message-interpolation
# or
$ yarn add message-interpolation
# or
$ pnpm i message-interpolation
# or
$ bun add message-interpolation

Usage

import mi from 'message-interpolation';

/**
 * Named interpolation
 */
const msg = `{say}, World!`;
mi(msg, { say: 'Hello' });
// Hello, World!

/**
 * List interpolation
 */
const alphabet = `{0} B {1} D {2} F G`;
mi(alphabet, ['A', 'C', 'E']);
// A B C D E F G

Readme

Keywords

Package Sidebar

Install

npm i message-interpolation

Weekly Downloads

20

Version

1.1.0

License

MIT

Unpacked Size

3.19 kB

Total Files

6

Last publish

Collaborators

  • shyam-chen