Skip to content

Instantly share code, notes, and snippets.

@jtenner
Last active December 27, 2015 10:19
Show Gist options
  • Save jtenner/7310346 to your computer and use it in GitHub Desktop.
Save jtenner/7310346 to your computer and use it in GitHub Desktop.
function HandleBar(templateStr, templateObject){
var that = templateObject;
return templateStr.replace(/\{\{([a-zA-Z\_0-9\.]*?)\}\}/g, function(match){
match.slice(2,-2).split('.').forEach(function(item){
that = that[item];
});
return that;
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment