@ngouy/easy-template

0.1.3 • Public • Published

EasyTemplate Gem Version

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.

Package Sidebar

Install

npm i @ngouy/easy-template

Weekly Downloads

28

Version

0.1.3

License

ISC

Unpacked Size

3.5 kB

Total Files

4

Last publish

Collaborators

  • ngouy