Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
ES6 Template like strings in ES3 compatible syntax.
// this is now a module:
var template = require('backtick-template');
// just string
const info = 'template';
`some ${info}` === template('some ${info}', {info});
// passing through a transformer
transform `some ${info}` ===
template(transform, 'some ${info}', {info});
// using it as String method
String.prototype.template = template.asMethod;
`some ${info}` === 'some ${info}'.template({info});
transform `some ${info}` ===
'some ${info}'.template(transform, {info});
Copy link

bcomnes commented Dec 11, 2016

Has anyone turned this into a module instead of a prototype extend?

Copy link

@aMarCruz @hooblei @JaroslavMoravec @ramtob @bcomnes

I've rewritten the original idea from scratch and covered 100% (let's say it was an excuse to test coveralls but ... hey ...)

Best Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment