Commit 7dbe75f1 authored by Alexander Yuzhin's avatar Alexander Yuzhin

[mobile] Add format method for the String type.

parent 398004c5
...@@ -42,6 +42,16 @@ ...@@ -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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment