Meet npm Pro: unlimited public & private packages + package-based permissions.Learn more »

str-template

0.0.4 • Public • Published

str-template

String templates for in depth properties replacements

var interpolate = require('str-template');
 
var data = {
    string: 'Martin',
    number: 25,
    object: {
        key: 'NodeJS'
    },
    array: [{},{value:'two'}]
};
 
var interpolated = interpolate("My name is ${string}, I'm ${number} and I've been a ${object.key} developer for like ${array[1].value} years", data);
 
console.log(interpolated);

Install

npm i str-template

DownloadsWeekly Downloads

1

Version

0.0.4

License

MIT

Last publish

Collaborators

  • avatar