Skip to content

Instantly share code, notes, and snippets.

@subhaze
Last active December 19, 2015 12:58
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 subhaze/5958260 to your computer and use it in GitHub Desktop.
Save subhaze/5958260 to your computer and use it in GitHub Desktop.
'Cause mootools is cool.
jQuery.moo = {
substitute: function(str, object, regexp){
return String(str).replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name){
if (match.charAt(0) == '\\') return match.slice(1);
return (object[name] != null) ? object[name] : '';
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment