just-template

interpolate a string with variables

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
just-template
5,794432.2.0a year ago8 years agoMinified + gzip package size for just-template in KB

Readme

just-template

Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.
🍦 Try it
npm install just-template
yarn add just-template

Interpolate a string with variables
import template from 'just-template';

var data = {
  a: {
    aa: {
      aaa: 'apple',
      bbb: 'pear'
    },
    bb: 'orange'
  },
  b: 'plum'
};
template('2 {{a.aa.aaa}}s, a {{a.aa.bbb}}, 3 {{a.bb}}s and a {{b}}. Yes 1 {{a.aa.bbb}}.', data);
// '2 apples, a pear, 3 oranges and a plum. Yes 1 pear.'