string-format-obj

Replace tokens from a string with values of an object

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
string-format-obj
1.1.16 years ago9 years agoMinified + gzip package size for string-format-obj in KB

Readme

string-format-obj
Replace tokens from a string with values of an object.

$ npm install --save string-format-obj
var format = require('string-format-obj');

format('{greeting} {thing}!', {
  greeting: 'Hello',
  thing: 'world'
});
// Hello world!

If you want to cache the string
var formatFunc = format('{greeting} {thing}!');

formatFunc({
  greeting: 'Howdy',
  thing: 'doody'
});
// Howdy doody!