Last active
August 29, 2015 14:05
-
-
Save kevincennis/aba3ab29ee0c10015517 to your computer and use it in GitHub Desktop.
tmpl.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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' }); |
wow such fast. very speed. much syntax.
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
👍