- Install:
npm install tickplate
- Require:
const t = require('tickplate');
- Place tag
t
before templated string
const t = require('tickplate');
const data = {
hello: 'Ave!',
myFriend: {
name: 'Marcus Aurelius',
toString() {
return this.name;
},
},
positions: ['emperor', 'philosopher', 'writer'],
};
const templ = t`Example: ${'hello'} ${'myFriend'}, the great ${'positions'} of Rome`;
console.log(templ(data));