Super lightweight string substitution module.
This module is a very simple string substitution module that allows for either key names, or index positions as the placeholder.
$ npm install --save string-sub
var sub = require('string-sub');
sub('Hello {0}!', 'world');
// => Hello world!
sub('Hello {0}, {1}!', 'world', 'nice to meet you');
// => Hello world, nice to meet you!
sub('Hello {subject}, {greeting}!', {greeting: 'nice to meet you', subject: 'world'});
// => Hello world, nice to meet you!
sub('Hello {0}, {1}!', ['world', 'nice to meet you']);
// => Hello world, nice to meet you!
MIT © Nate Cavanaugh