just-template
TypeScript icon, indicating that this package has built-in type declarations

2.2.0 • Public • Published

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.'

/just-template/

    Package Sidebar

    Install

    npm i just-template

    Weekly Downloads

    1,214

    Version

    2.2.0

    License

    MIT

    Unpacked Size

    5.52 kB

    Total Files

    9

    Last publish

    Collaborators

    • angus-c