IT:AD:JScript:XAct
Summary
I use the folloing in most apps these days…
Example
XAct = {
ns: function() {
var ln = arguments.length,
i, value, split, x, xln, parts, object;
for (i = 0; i < ln; i++) {
value = arguments[i];
parts = value.split(".");
object = (window.XAct)
? window[parts[0]] = Object(window[parts[0]])
: arguments.callee.caller.arguments[0];
for (x = 1, xln = parts.length; x < xln; x++)
object = object[parts[x]] = Object(object[parts[x]]);
}
return object;
}
};
String.prototype.format = function () {
var args = arguments;
return this.replace(/{(\d+)}/g, function (match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match;
});
};