fake-template

1.0.0 • Public • Published

fake-template

Who needs real templates anyway?

Installation

npm i fake-template --save

Usage

const template = require('fake-template')
const gloriousMissive = template('Dear ${name}, we found the perfect ${title} job in ${location} for you!')
console.log(gloriousMissive({ name: 'Joanna', title: 'Cosmonaut', location: 'London' }))

This is equivalent to

const name = 'Joanna', title = 'Cosmonaut', location = 'London'
console.log(`Dear ${name}, we found the perfect ${title} job in ${location} for you!`)

Contributions

Bug reports highly appreciated

PRs super welcome

TODO

For completeness' sake it would be good to support raw_strings.

Better error messages would be great as well.

Tests

Tests live in the index file in the shape of a bunch of asserts.

Tests get removed automatically at postinstall using sed.

License

MIT

Package Sidebar

Install

npm i fake-template

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

5.42 kB

Total Files

3

Last publish

Collaborators

  • framp