[mobile] Add format method for the String type.

This commit is contained in:
Alexander Yuzhin 2016-11-23 11:43:13 +03:00
parent 398004c59c
commit 7dbe75f117

View file

@ -42,6 +42,16 @@
define( define(
['jquery','underscore','framework7'], ['jquery','underscore','framework7'],
function () { function () {
//Extend String
if (!String.prototype.format) {
String.prototype.format = function() {
var args = arguments;
return this.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != 'undefined' ? args[number] : match;
});
};
}
//Extend jQuery functions //Extend jQuery functions
jQuery.fn.extend( { jQuery.fn.extend( {
single: function(types, selector, data, fn) { single: function(types, selector, data, fn) {