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

4.1.3 • Public • Published

Rendy License NPM version Build Status Coverage

Simple template engine compatible with handlebars and mustache.

Install

NPM_INFO

npm i rendy

How to use?

In ESM

import rendy from 'rendy';

in CommonJS:

const rendy = require('rendy');

API

rendy(template: string, value: Values, modifiers?: Modifiers)

Values is:

type Values = {
    [key: string]: unknown;
};
type Modifiers = {
    [key: string]: (value: unknown) => string;
};
rendy('hello {{ value }}', {
    value: 'world',
});

// returns
'hello world';

const values = {
    names: ['a', 'b', 'c'],
};

const modifiers = {
    implode: (a) => a.join(', '),
};

rendy('hello {{ names | implode }}', values, modifiers);
// returns
'hello a, b, c';

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i rendy

Weekly Downloads

3,579

Version

4.1.3

License

MIT

Unpacked Size

8.76 kB

Total Files

6

Last publish

Collaborators

  • coderaiser