Nano(~170), high performance string template library, based on ES6 String template syntax.
npm install tplv> Nano(~170b), High performance string template library, based on ES6 String template syntax.




``bash`
$ npm i --save tplv
- render template string
`ts
import { render } from 'tplv';
const template = '${ name }, ${value}(${percent} | Top ${array[2]})';
const data = {
name: 'Hangzhou',
value: 1200,
percent: '13%',
array: [1, 2, 3, 4]
};
render(template, data); // Hangzhou, 1200(13% | Top 3) will be got`
- compile mode
> For 13x faster performance then render mode.
`ts
import { compile } from 'tplv';
const template = '${ name }, ${value}(${percent} | Top ${array[2]})';
const data = {
name: 'Hangzhou',
value: 1200,
percent: '13%',
array: [1, 2, 3, 4]
};
const fn = compile(template, ['name', 'value', 'percent', 'array']);
fn(data); // Hangzhou, 1200(13% | Top 3) will be got`
Run performance test with rendering-test.
`bashinstall dependence
$ npm install
MIT@hustcc.