_.chain(obj) _ _chain = true, _ _wrapped, ( ). _.mixin(_) #1210 (). _.mixin _ ( ! _.prototype). _.mixin _ ( , ).
:
function () {
var args = [this._wrapped];
push.apply(args, arguments);
return result.call(this, func.apply(_, args));
}
(, , , func )
result :
var result = function(obj) {
return this._chain ? _(obj).chain() : obj;
};
, , func.apply(_, args), _chain (_.chain ), _(obj).chain(), :)
, !
:
var _ = function(obj) {
if (obj instanceof _) return obj;
if (!(this instanceof _)) return new _(obj);
this._wrapped = obj;
};
:
func = function(a){this.a = a;}
b = func(2);
b.a
c = new func(2);
c.a
( ),
- ?