1.12.0 • Published 4 years ago

@marcopeg/template v1.12.0

Weekly downloads
43
License
MIT
Repository
github
Last release
4 years ago

@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
1.12.0

4 years ago

1.9.0

4 years ago

1.8.0

4 years ago

1.7.1

4 years ago

1.7.0

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.0

5 years ago

0.2.9

5 years ago

0.2.0

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago