Skip to content

JordanSinko/render-stencil

Repository files navigation

render-stencil

Travis branch Sonarcloud Status npm npm

Overview

Installation

npm install render-stencil

API

render-stencil(template, variables, options)

Description

// Works with objects and arrays:
const render = require('render-stencil');
const stencil = { name: '{{name}}', hobbies: ['{{hobby}}'] };
const rendered = render(stencil, { name: 'John', hobby: 'coding' }); // -> { name: 'John', hobbies: ['coding'] }

// Works with nested views:
const render = require('render-stencil');
const stencil = { name: '{{name.first}}' };
const rendered = render(stencil, { name: { first: 'John' } }); // -> { name: 'John' }

// Works with strings:
const render = require('render-stencil');
const rendered = render('Hello, {{name}}!', { name: 'John' }); // -> Hello, John!

// If you only need to replace string stencils, then you can also do this:
const render = require('render-stencil/string');
const rendered = render('Hello, {{name}}!', { name: 'John' }); // -> Hello, John!

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published