diff --git a/lib/Bootstrap.js b/lib/Bootstrap.js index d53af324..0711fba4 100644 --- a/lib/Bootstrap.js +++ b/lib/Bootstrap.js @@ -52,7 +52,7 @@ new function() { : null; } - function inject(dest, src, enumerable, base, generics) { + function inject(dest, src, enumerable, base, preserve, generics) { var beans; function field(name, val, dontCheck, generics) { @@ -60,11 +60,11 @@ new function() { val = (val = describe(src, name)) && (val.get ? val : val.value); var type = typeof val, func = type == 'function', res = val, prev = dest[name], bean, part; - if (generics && func && (!src.preserve || !generics[name])) generics[name] = function(bind) { + if (generics && func && (!preserve || !generics[name])) generics[name] = function(bind) { return bind && dest[name].apply(bind, Array.prototype.slice.call(arguments, 1)); } - if ((dontCheck || val !== undefined && has(src, name)) && (!prev || !src.preserve)) { + if ((dontCheck || val !== undefined && has(src, name)) && (!prev || !preserve)) { if (func) { if (prev && /\bthis\.base\b/.test(val)) { var fromBase = base && base[name] == prev; @@ -122,8 +122,8 @@ new function() { inject: function(src) { if (src) { var proto = this.prototype, base = proto.__proto__ && proto.__proto__.constructor; - inject(proto, src, false, base && base.prototype, src.generics && this); - inject(this, src.statics, true, base); + inject(proto, src, false, base && base.prototype, src.preserve, src.generics && this); + inject(this, src.statics, true, base, src.preserve); } for (var i = 1, l = arguments.length; i < l; i++) this.inject(arguments[i]); @@ -482,6 +482,12 @@ Array.inject({ for (var l = this.length; i < l; i++) value = fn.call(null, value, this[i], i, this); return value; + }, + + statics: { + isArray: function(obj) { + return Object.prototype.toString.call(obj) === '[object Array]'; + } } }, Enumerable, { generics: true,