Sha256: eb561132b630b5c668ce96361f1b1307b9e9d520977c4bb80112b07f47a8c684

Contents?: true

Size: 737 Bytes

Versions: 2

Compression:

Stored size: 737 Bytes

Contents

String.prototype.format = function (args) {
    var result = this;
    if (arguments.length > 0) {
        if (arguments.length == 1 && typeof (args) == "object") {
            for (var key in args) {
                if (args[key] != undefined) {
                    var reg = new RegExp("({" + key + "})", "g");
                    result = result.replace(reg, args[key]);
                }
            }
        }
        else {
            for (var i = 0; i < arguments.length; i++) {
                if (arguments[i] != undefined) {
                    var reg = new RegExp("({[" + i + "]})", "g");
                    result = result.replace(reg, arguments[i]);
                }
            }
        }
    }
    return result;
};

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jextend-0.1.3 vendor/assets/javascripts/jextend/string.js
jextend-0.1.2 vendor/assets/javascripts/jextend/string.js