Skip to content

Instantly share code, notes, and snippets.

@bterlson
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bterlson/2d3469e0f1bc2cf74d83 to your computer and use it in GitHub Desktop.
Save bterlson/2d3469e0f1bc2cf74d83 to your computer and use it in GitHub Desktop.
Chained tagged templates
function concat(head, template) {
"use strict";
var head;
if(!template) {
template = head;
head = '';
}
var fn = concat.bind(null, head + template[0]);
fn.toString = function() {
return head + template[0];
};
return fn
}
concat`1``2``abc`.toString(); // 12abc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment