Skip to content

Commit f2e7063

Browse files
committed
Bump to v4.17.20.
1 parent f9cd8f5 commit f2e7063

19 files changed

+337
-210
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# lodash v4.17.15
1+
# lodash v4.17.20
22

33
The [Lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules.
44

@@ -28,7 +28,7 @@ var at = require('lodash/at');
2828
var curryN = require('lodash/fp/curryN');
2929
```
3030

31-
See the [package source](https://github.com/lodash/lodash/tree/4.17.15-npm) for more details.
31+
See the [package source](https://github.com/lodash/lodash/tree/4.17.20-npm) for more details.
3232

3333
**Note:**<br>
3434
Install [n_](https://www.npmjs.com/package/n_) for Lodash use in the Node.js < 6 REPL.

_baseClone.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ var Stack = require('./_Stack'),
1818
isMap = require('./isMap'),
1919
isObject = require('./isObject'),
2020
isSet = require('./isSet'),
21-
keys = require('./keys');
21+
keys = require('./keys'),
22+
keysIn = require('./keysIn');
2223

2324
/** Used to compose bitmasks for cloning. */
2425
var CLONE_DEEP_FLAG = 1,

_baseOrderBy.js

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
var arrayMap = require('./_arrayMap'),
2+
baseGet = require('./_baseGet'),
23
baseIteratee = require('./_baseIteratee'),
34
baseMap = require('./_baseMap'),
45
baseSortBy = require('./_baseSortBy'),
56
baseUnary = require('./_baseUnary'),
67
compareMultiple = require('./_compareMultiple'),
7-
identity = require('./identity');
8+
identity = require('./identity'),
9+
isArray = require('./isArray');
810

911
/**
1012
* The base implementation of `_.orderBy` without param guards.
@@ -16,8 +18,21 @@ var arrayMap = require('./_arrayMap'),
1618
* @returns {Array} Returns the new sorted array.
1719
*/
1820
function baseOrderBy(collection, iteratees, orders) {
21+
if (iteratees.length) {
22+
iteratees = arrayMap(iteratees, function(iteratee) {
23+
if (isArray(iteratee)) {
24+
return function(value) {
25+
return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
26+
}
27+
}
28+
return iteratee;
29+
});
30+
} else {
31+
iteratees = [identity];
32+
}
33+
1934
var index = -1;
20-
iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(baseIteratee));
35+
iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
2136

2237
var result = baseMap(collection, function(value, key, collection) {
2338
var criteria = arrayMap(iteratees, function(iteratee) {

_baseSet.js

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ function baseSet(object, path, value, customizer) {
2929
var key = toKey(path[index]),
3030
newValue = value;
3131

32+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
33+
return object;
34+
}
35+
3236
if (index != lastIndex) {
3337
var objValue = nested[key];
3438
newValue = customizer ? customizer(objValue, key, nested) : undefined;

_baseSortedIndexBy.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@ var nativeFloor = Math.floor,
2222
* into `array`.
2323
*/
2424
function baseSortedIndexBy(array, value, iteratee, retHighest) {
25-
value = iteratee(value);
26-
2725
var low = 0,
28-
high = array == null ? 0 : array.length,
29-
valIsNaN = value !== value,
26+
high = array == null ? 0 : array.length;
27+
if (high === 0) {
28+
return 0;
29+
}
30+
31+
value = iteratee(value);
32+
var valIsNaN = value !== value,
3033
valIsNull = value === null,
3134
valIsSymbol = isSymbol(value),
3235
valIsUndefined = value === undefined;

_equalArrays.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
2727
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
2828
return false;
2929
}
30-
// Assume cyclic values are equal.
31-
var stacked = stack.get(array);
32-
if (stacked && stack.get(other)) {
33-
return stacked == other;
30+
// Check that cyclic values are equal.
31+
var arrStacked = stack.get(array);
32+
var othStacked = stack.get(other);
33+
if (arrStacked && othStacked) {
34+
return arrStacked == other && othStacked == array;
3435
}
3536
var index = -1,
3637
result = true,

_equalObjects.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
3939
return false;
4040
}
4141
}
42-
// Assume cyclic values are equal.
43-
var stacked = stack.get(object);
44-
if (stacked && stack.get(other)) {
45-
return stacked == other;
42+
// Check that cyclic values are equal.
43+
var objStacked = stack.get(object);
44+
var othStacked = stack.get(other);
45+
if (objStacked && othStacked) {
46+
return objStacked == other && othStacked == object;
4647
}
4748
var result = true;
4849
stack.set(object, other);

core.js

+27-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
var undefined;
1414

1515
/** Used as the semantic version number. */
16-
var VERSION = '4.17.15';
16+
var VERSION = '4.17.20';
1717

1818
/** Error message constants. */
1919
var FUNC_ERROR_TEXT = 'Expected a function';
@@ -1183,6 +1183,12 @@
11831183
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
11841184
return false;
11851185
}
1186+
// Check that cyclic values are equal.
1187+
var arrStacked = stack.get(array);
1188+
var othStacked = stack.get(other);
1189+
if (arrStacked && othStacked) {
1190+
return arrStacked == other && othStacked == array;
1191+
}
11861192
var index = -1,
11871193
result = true,
11881194
seen = (bitmask & COMPARE_UNORDERED_FLAG) ? [] : undefined;
@@ -1293,6 +1299,12 @@
12931299
return false;
12941300
}
12951301
}
1302+
// Check that cyclic values are equal.
1303+
var objStacked = stack.get(object);
1304+
var othStacked = stack.get(other);
1305+
if (objStacked && othStacked) {
1306+
return objStacked == other && othStacked == object;
1307+
}
12961308
var result = true;
12971309

12981310
var skipCtor = isPartial;
@@ -1935,6 +1947,10 @@
19351947
* // The `_.property` iteratee shorthand.
19361948
* _.filter(users, 'active');
19371949
* // => objects for ['barney']
1950+
*
1951+
* // Combining several predicates using `_.overEvery` or `_.overSome`.
1952+
* _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
1953+
* // => objects for ['fred', 'barney']
19381954
*/
19391955
function filter(collection, predicate) {
19401956
return baseFilter(collection, baseIteratee(predicate));
@@ -2188,15 +2204,15 @@
21882204
* var users = [
21892205
* { 'user': 'fred', 'age': 48 },
21902206
* { 'user': 'barney', 'age': 36 },
2191-
* { 'user': 'fred', 'age': 40 },
2207+
* { 'user': 'fred', 'age': 30 },
21922208
* { 'user': 'barney', 'age': 34 }
21932209
* ];
21942210
*
21952211
* _.sortBy(users, [function(o) { return o.user; }]);
2196-
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
2212+
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
21972213
*
21982214
* _.sortBy(users, ['user', 'age']);
2199-
* // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
2215+
* // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
22002216
*/
22012217
function sortBy(collection, iteratee) {
22022218
var index = 0;
@@ -3503,6 +3519,9 @@
35033519
* values against any array or object value, respectively. See `_.isEqual`
35043520
* for a list of supported value comparisons.
35053521
*
3522+
* **Note:** Multiple values can be checked by combining several matchers
3523+
* using `_.overSome`
3524+
*
35063525
* @static
35073526
* @memberOf _
35083527
* @since 3.0.0
@@ -3518,6 +3537,10 @@
35183537
*
35193538
* _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
35203539
* // => [{ 'a': 4, 'b': 5, 'c': 6 }]
3540+
*
3541+
* // Checking for several possible values
3542+
* _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
3543+
* // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
35213544
*/
35223545
function matches(source) {
35233546
return baseMatches(assign({}, source));

0 commit comments

Comments
 (0)