0.1.3 • Published 5 years ago
@ngouy/easy-template v0.1.3
EasyTemplate
Easy template language in ruby, with only variable substitution.
Documentation
/**
* @param {string} text - the string containing your template.
* @param {object} variables - containing the values to substitute in place of the keys enclosed by `{` and `}`.
*/
EasyTemplate.process(text, variables)
NB: If you want to use raw {
in your template you can escape it with \
.
Examples:
EasyTemplate.process('Hello Mr {last name}!', {
'last name': 'Bowie'
})
Hello Mr Bowie!
EasyTemplate.process('\{first name} {last name}!', {
'first name': 'Nina',
'last name': 'Simone'
})
{first name} Simone!
License
Copyright © 2019 Nathan Gouy, EasyTemplate is free software, and may be redistributed under the terms specified in the license.