mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Make _chain and _wrapped double underscored to further avoid conflicts.
Former-commit-id: 27f545d99cc383be05509ac7382e42fc727e0215
This commit is contained in:
@@ -104,9 +104,9 @@
|
|||||||
/** Used to protect the specified properties from getting minified */
|
/** Used to protect the specified properties from getting minified */
|
||||||
var propWhitelist = [
|
var propWhitelist = [
|
||||||
'_',
|
'_',
|
||||||
'_chain',
|
'__chain__',
|
||||||
'_wrapped',
|
|
||||||
'__proto__',
|
'__proto__',
|
||||||
|
'__wrapped__',
|
||||||
'after',
|
'after',
|
||||||
'all',
|
'all',
|
||||||
'amd',
|
'amd',
|
||||||
|
|||||||
32
lodash.js
32
lodash.js
@@ -308,10 +308,10 @@
|
|||||||
*/
|
*/
|
||||||
function LoDash(value) {
|
function LoDash(value) {
|
||||||
// exit early if already wrapped
|
// exit early if already wrapped
|
||||||
if (value && value._wrapped) {
|
if (value && value.__wrapped__) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
this._wrapped = value;
|
this.__wrapped__ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1452,8 +1452,8 @@
|
|||||||
}
|
}
|
||||||
if (objectTypes[typeof a] || objectTypes[typeof b] || thorough.value) {
|
if (objectTypes[typeof a] || objectTypes[typeof b] || thorough.value) {
|
||||||
// unwrap any LoDash wrapped values
|
// unwrap any LoDash wrapped values
|
||||||
a = a._wrapped || a;
|
a = a.__wrapped__ || a;
|
||||||
b = b._wrapped || b;
|
b = b.__wrapped__ || b;
|
||||||
|
|
||||||
// use custom `isEqual` method if available
|
// use custom `isEqual` method if available
|
||||||
if (a.isEqual && isFunction(a.isEqual)) {
|
if (a.isEqual && isFunction(a.isEqual)) {
|
||||||
@@ -3794,14 +3794,14 @@
|
|||||||
var func = lodash[methodName] = object[methodName];
|
var func = lodash[methodName] = object[methodName];
|
||||||
|
|
||||||
LoDash.prototype[methodName] = function() {
|
LoDash.prototype[methodName] = function() {
|
||||||
var args = [this._wrapped];
|
var args = [this.__wrapped__];
|
||||||
if (arguments.length) {
|
if (arguments.length) {
|
||||||
push.apply(args, arguments);
|
push.apply(args, arguments);
|
||||||
}
|
}
|
||||||
var result = func.apply(lodash, args);
|
var result = func.apply(lodash, args);
|
||||||
if (this._chain) {
|
if (this.__chain__) {
|
||||||
result = new LoDash(result);
|
result = new LoDash(result);
|
||||||
result._chain = true;
|
result.__chain__ = true;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
@@ -4178,7 +4178,7 @@
|
|||||||
*/
|
*/
|
||||||
function chain(value) {
|
function chain(value) {
|
||||||
value = new LoDash(value);
|
value = new LoDash(value);
|
||||||
value._chain = true;
|
value.__chain__ = true;
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4222,7 +4222,7 @@
|
|||||||
* // => [1, 2, 3]
|
* // => [1, 2, 3]
|
||||||
*/
|
*/
|
||||||
function wrapperChain() {
|
function wrapperChain() {
|
||||||
this._chain = true;
|
this.__chain__ = true;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4239,7 +4239,7 @@
|
|||||||
* // => [1, 2, 3]
|
* // => [1, 2, 3]
|
||||||
*/
|
*/
|
||||||
function wrapperValue() {
|
function wrapperValue() {
|
||||||
return this._wrapped;
|
return this.__wrapped__;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
@@ -4387,7 +4387,7 @@
|
|||||||
var func = ArrayProto[methodName];
|
var func = ArrayProto[methodName];
|
||||||
|
|
||||||
LoDash.prototype[methodName] = function() {
|
LoDash.prototype[methodName] = function() {
|
||||||
var value = this._wrapped;
|
var value = this.__wrapped__;
|
||||||
func.apply(value, arguments);
|
func.apply(value, arguments);
|
||||||
|
|
||||||
// avoid array-like object bugs with `Array#shift` and `Array#splice` in
|
// avoid array-like object bugs with `Array#shift` and `Array#splice` in
|
||||||
@@ -4395,9 +4395,9 @@
|
|||||||
if (hasObjectSpliceBug && value.length === 0) {
|
if (hasObjectSpliceBug && value.length === 0) {
|
||||||
delete value[0];
|
delete value[0];
|
||||||
}
|
}
|
||||||
if (this._chain) {
|
if (this.__chain__) {
|
||||||
value = new LoDash(value);
|
value = new LoDash(value);
|
||||||
value._chain = true;
|
value.__chain__ = true;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
@@ -4408,12 +4408,12 @@
|
|||||||
var func = ArrayProto[methodName];
|
var func = ArrayProto[methodName];
|
||||||
|
|
||||||
LoDash.prototype[methodName] = function() {
|
LoDash.prototype[methodName] = function() {
|
||||||
var value = this._wrapped,
|
var value = this.__wrapped__,
|
||||||
result = func.apply(value, arguments);
|
result = func.apply(value, arguments);
|
||||||
|
|
||||||
if (this._chain) {
|
if (this.__chain__) {
|
||||||
result = new LoDash(result);
|
result = new LoDash(result);
|
||||||
result._chain = true;
|
result.__chain__ = true;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user