node package manager
Stop writing boring code. Discover, share, and reuse within your team. Create a free org »

subs

subs

tiny string substitution

Installation

Install with component(1):

$ component install matthewmueller/subs

Install with npm:

$ npm install subs

Example

// subs(tpl, obj) 
var tpl = 'my favorite {food} is: {name}';
var str = subs(str, { food: 'fruit', name: 'peach' });
 
// currying: subs(tpl)(obj) 
var tpl = 'my favorite {food} is: {name}';
var fn = subs(tpl);
var str = fn({ food: 'fruit', name: 'peach' });

Test

make test

License

MIT