Here you can find the source of format()
'use strict';//from w ww.j a v a 2 s.c o m String.prototype.format = function () { var args = arguments; return this.replace(/{(\d+)}/g, function (match, number) { if (typeof args[number] !== 'undefined') { return args[number]; } else { return match; } }); };
String.prototype.format = function () { var args = arguments; return this.replace(/\{\{|\}\}|\{(\d+)\}/g, function (m, n) { if (m == "{{") { return "{"; } if (m == "}}") { return "}"; } return args[n]; }); };
String.prototype.format = function () { var formatted = this, i, size = arguments.length; for (i = 0; i < size; i++) { var regexp = new RegExp('\\{' + i + '\\}', 'gi'); formatted = formatted.replace(regexp, arguments[i]); return formatted; };
String.prototype.format = function() { var formatted = this; for (var i = 0; i < arguments.length; i++) { var regexp = new RegExp('\\{'+i+'\\}', 'gi'); formatted = formatted.replace(regexp, arguments[i]); return formatted; }; var ch = function(o) { ...
String.prototype.format = function() { var formatted = this; for( var arg in arguments ) { formatted = formatted.replace("{" + arg + "}", arguments[arg]); return formatted; };
String.prototype.format = function(){ var content = this; for (var i=0; i < arguments.length; i++) var replacement = '{' + i + '}'; content = content.replace(replacement, arguments[i]); return content; }; ...
String.prototype.format = function() { var pattern = /\{\d+\}/g; var args = arguments; return this.replace(pattern,function(capture){return args[capture.match(/\d+/)];}); var getRandomInt = function(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; };
String.prototype.format=function(){ var args = arguments; return this.replace(/{(\d+)}/g, function(match, number){return typeof args[number] != 'undefined'?args[number]:match;}); };
String.prototype.format = function () { var args = arguments; return this.replace(/{(\d+)}/g, function (match, number) { return args[number] != undefined ? args[number] : match; }); };
'use strict'; String.prototype.format = function(){ var args = arguments; return this.replace(/{(\d+)}/g, function(match, index){ return args[index]; }); }; module.exports = String;