Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String.prototype.expandUriTemplate = String.prototype.expandUriTemplate ||
- function () {
- "use strict";
- var str = this.toString();
- if (arguments.length) {
- var t = typeof arguments[0];
- var key;
- var args = ("string" === t || "number" === t) ?
- Array.prototype.slice.call(arguments)
- : arguments[0];
- for (key in args) {
- str = str.replace(new RegExp("\{" + key + "\}", "gi"), args[key]);
- }
- }
- return str;
- };
Add Comment
Please, Sign In to add comment