Here you can find the source of supplant(o)
String.prototype.supplant = function (o) { return this.replace(/{([^{}]*)}/g, function (a, b) { var r = o[b]; return typeof r === 'string' || typeof r === 'number' ? r : a; }// w w w.j av a 2 s. co m ); };
String.prototype.supplant = function (o) { return this.replace(/{([^{}]*)}/g, function (a, b) { var r = o[b]; return typeof r === "string" || typeof r === "number" ? r : a; }); }; Array.prototype.flatten = function() { return [].concat.apply([], this); }; ...
String.prototype.supplant = function (o) { return this.replace( /\{([^{}]*)\}/g, function (a, b) { var r = o[b]; return typeof r === 'string' || typeof r === 'number' ? r : a; ); }; ...
String.prototype.supplant = function (o) { return this.replace(/{([^{}]*)}/g, function (a, b) { var r = o[b]; return (r !== undefined) ? r : a; ); };
String.prototype.supplant = function (obj) { function replacer(_, name) { var value = obj[name] var type = (typeof value) if (value instanceof Array) return value.toString(); if (type === 'string') return value; if (type === 'number') return value; return name return this.replace(/{([^{}]*)}/g, replacer); };