Skip to content

Instantly share code, notes, and snippets.

@kevincennis
Last active August 29, 2015 14:05
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 kevincennis/aba3ab29ee0c10015517 to your computer and use it in GitHub Desktop.
Save kevincennis/aba3ab29ee0c10015517 to your computer and use it in GitHub Desktop.
tmpl.js
// KEWL TEMPLATING LIBRARY
function tmpl( fn ) {
return function( data ) {
return fn( data );
};
}
// DEMO...
var renderer = tmpl(function( data ) {
return '<p>hello ' + data.text + '!</p>';
});
renderer({ text: 'world' });
@kevincennis
Copy link
Author

👍

@kevincennis
Copy link
Author

wow such fast. very speed. much syntax.

@spmurrayzzz
Copy link

Line 5: Missing semicolon.

wontmerge!

@kevincennis
Copy link
Author

good call bro i read on stackoverflow that ASI automatically deopts your function so this should make it alot faster

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