2010-03-30 13:02:51 +00:00
|
|
|
(function(){
|
2010-03-30 20:48:43 +00:00
|
|
|
var utilities;
|
2010-03-30 13:02:51 +00:00
|
|
|
if (!((typeof process !== "undefined" && process !== null))) {
|
|
|
|
this.exports = this;
|
|
|
|
}
|
2010-03-30 20:14:07 +00:00
|
|
|
exports.utilities = (function() {
|
|
|
|
utilities = function utilities() { };
|
2010-03-30 20:48:43 +00:00
|
|
|
utilities.key = function key(name) {
|
|
|
|
return "__" + name;
|
|
|
|
};
|
2010-03-30 20:14:07 +00:00
|
|
|
utilities.format = function format(key, tab) {
|
2010-03-30 20:48:43 +00:00
|
|
|
return "" + (utilities.key(key)) + " = " + (utilities.functions[key].replace(/\n/g, "\n" + tab) || 'undefined');
|
2010-03-30 20:14:07 +00:00
|
|
|
};
|
|
|
|
utilities.dependencies = {
|
2010-03-30 22:27:53 +00:00
|
|
|
bind: ['slice']
|
2010-03-30 20:14:07 +00:00
|
|
|
};
|
|
|
|
utilities.functions = {
|
|
|
|
extend: "function(child, parent) {\n var ctor = function(){ };\n ctor.prototype = parent.prototype;\n child.__superClass__ = parent.prototype;\n child.prototype = new ctor();\n child.prototype.constructor = child;\n}",
|
2010-03-30 22:49:55 +00:00
|
|
|
bind: "function(func, obj, args) {\n return function() {\n return func.apply(obj || {}, args ? args.concat(" + (utilities.key('slice')) + ".call(arguments, 0)) : arguments);\n };\n}",
|
2010-03-30 20:14:07 +00:00
|
|
|
range: "function(array, from, to, exclusive) {\n return [\n (from < 0 ? from + array.length : from || 0),\n (to < 0 ? to + array.length : to || array.length) + (exclusive ? 0 : 1)\n ];\n}",
|
2010-03-30 20:48:43 +00:00
|
|
|
hasProp: 'Object.prototype.hasOwnProperty',
|
2010-03-30 22:27:53 +00:00
|
|
|
slice: 'Array.prototype.slice'
|
2010-03-30 20:14:07 +00:00
|
|
|
};
|
|
|
|
return utilities;
|
|
|
|
}).call(this);
|
2010-03-30 13:02:51 +00:00
|
|
|
})();
|