npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

@marcopeg/template

0.2.9 • Public • Published

@marcopeg/template

Minimalist variable substitution utility inspired by mustache that implements just few variable substitution features.

  • no loops
  • no conditionals
  • no filters

If you need a full template engine, use mustache :-)

import template from '@marcopeg/template'
 
const data = {
    name: 'marco',
    surname: 'pegoraro',
    family: {
        father: { name: 'piero' },
        mother: { name: 'teresa' },
        siblings: [
            { name: 'giulia' },
            { name: 'elisa' },
        ]
    }
}
 
template('name', name)
// -> marco
 
template('{{ name }} {{ surname }}', data)
// -> marco pegoraro
 
template('{{ name }} {{ surname }} has {{ family.siblings.$LENGTH }} siblings', data)
// -> marco pegoraro has 2 siblings

install

npm i @marcopeg/template

Downloadsweekly downloads

55

version

0.2.9

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability