Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Just string templating.

View string-proto.js
1 2 3 4 5 6 7 8 9 10 11
String.prototype.format = function( params, opts){
var opts = opts || new Object();
opts.head = opts.head || '${';
opts.tail = opts.tail || '}';
var r = this;
for(param in params)
r = r.split( new Array(opts.head, param, opts.tail).join('') ).join(params[param]);
return r;
};
// var template = 'awe${neat}'.format({'neat':'some'});
// console.log(template);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.