mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17:48 +00:00
Rework lodash.
This commit is contained in:
16
lodash.js
16
lodash.js
@@ -791,10 +791,13 @@
|
|||||||
* // => true
|
* // => true
|
||||||
*/
|
*/
|
||||||
function lodash(value) {
|
function lodash(value) {
|
||||||
// don't wrap if already wrapped, even if wrapped by a different `lodash` constructor
|
if (value instanceof lodashWrapper) {
|
||||||
return (value && typeof value == 'object' && !isArray(value) && hasOwnProperty.call(value, '__wrapped__'))
|
return value;
|
||||||
? value
|
}
|
||||||
: new lodashWrapper(value);
|
if (value && typeof value == 'object' && !isArray(value) && hasOwnProperty.call(value, '__wrapped__')) {
|
||||||
|
value = value.__wrapped__;
|
||||||
|
}
|
||||||
|
return new lodashWrapper(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -809,8 +812,6 @@
|
|||||||
this.__chain__ = !!chainAll;
|
this.__chain__ = !!chainAll;
|
||||||
this.__wrapped__ = value;
|
this.__wrapped__ = value;
|
||||||
}
|
}
|
||||||
// ensure `new lodashWrapper` is an instance of `lodash`
|
|
||||||
lodashWrapper.prototype = lodash.prototype;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An object used to flag environments features.
|
* An object used to flag environments features.
|
||||||
@@ -8605,6 +8606,9 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// ensure `new lodashWrapper` is an instance of `lodash`
|
||||||
|
lodashWrapper.prototype = lodash.prototype;
|
||||||
|
|
||||||
// add functions that return wrapped values when chaining
|
// add functions that return wrapped values when chaining
|
||||||
lodash.after = after;
|
lodash.after = after;
|
||||||
lodash.assign = assign;
|
lodash.assign = assign;
|
||||||
|
|||||||
Reference in New Issue
Block a user