es6-template-render
v1.3.1
Published
library to render es6 template base on objects
Downloads
423
Maintainers
Readme
Es6-template-render
library to render es6 template base on objects
Requirements
- node 4+
Install
npm install es6-template-render
Create resource
import render from 'es6-template-render';
render('/api/${param1}/${param2}/', {param1: 'foo', param2: 'bar'})
// Output:
// '/api/foo/bar/'
or ES5
var render = require('es6-template-render');
render('/api/${param1}/${param2}/', {param1: 'foo', param2: 'bar'})
// Output:
// '/api/foo/bar/'
Use objects instead of string
import render from 'es6-template-render';
render('Hey, ${user.name}', { user: {name: 'Andrea' }})
// Output:
// 'Hey, Andrea'
Contributors
License
MIT © Guillaume Vincent