Skip to content

Commit 3a3b0fd

Browse files
committed
Bump to v4.17.16
1 parent c84fe82 commit 3a3b0fd

File tree

3 files changed

+210
-159
lines changed

3 files changed

+210
-159
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# lodash v4.17.15
1+
# lodash v4.17.16
22

33
[Site](https://lodash.com/) |
44
[Docs](https://lodash.com/docs) |
@@ -20,11 +20,11 @@ $ lodash core -o ./dist/lodash.core.js
2020

2121
## Download
2222

23-
* [Core build](https://raw.githubusercontent.com/lodash/lodash/4.17.15/dist/lodash.core.js) ([~4 kB gzipped](https://raw.githubusercontent.com/lodash/lodash/4.17.15/dist/lodash.core.min.js))
24-
* [Full build](https://raw.githubusercontent.com/lodash/lodash/4.17.15/dist/lodash.js) ([~24 kB gzipped](https://raw.githubusercontent.com/lodash/lodash/4.17.15/dist/lodash.min.js))
23+
* [Core build](https://raw.githubusercontent.com/lodash/lodash/4.17.16/dist/lodash.core.js) ([~4 kB gzipped](https://raw.githubusercontent.com/lodash/lodash/4.17.16/dist/lodash.core.min.js))
24+
* [Full build](https://raw.githubusercontent.com/lodash/lodash/4.17.16/dist/lodash.js) ([~24 kB gzipped](https://raw.githubusercontent.com/lodash/lodash/4.17.16/dist/lodash.min.js))
2525
* [CDN copies](https://www.jsdelivr.com/projects/lodash)
2626

27-
Lodash is released under the [MIT license](https://raw.githubusercontent.com/lodash/lodash/4.17.15/LICENSE) & supports modern environments.<br>
27+
Lodash is released under the [MIT license](https://raw.githubusercontent.com/lodash/lodash/4.17.16/LICENSE) & supports modern environments.<br>
2828
Review the [build differences](https://github.com/lodash/lodash/wiki/build-differences) & pick one that’s right for you.
2929

3030
## Installation

dist/lodash.js

Lines changed: 70 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3719,8 +3719,21 @@
37193719
* @returns {Array} Returns the new sorted array.
37203720
*/
37213721
function baseOrderBy(collection, iteratees, orders) {
3722+
if (iteratees.length) {
3723+
iteratees = arrayMap(iteratees, function(iteratee) {
3724+
if (isArray(iteratee)) {
3725+
return function(value) {
3726+
return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
3727+
}
3728+
}
3729+
return iteratee;
3730+
});
3731+
} else {
3732+
iteratees = [identity];
3733+
}
3734+
37223735
var index = -1;
3723-
iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
3736+
iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
37243737

37253738
var result = baseMap(collection, function(value, key, collection) {
37263739
var criteria = arrayMap(iteratees, function(iteratee) {
@@ -3977,6 +3990,10 @@
39773990
var key = toKey(path[index]),
39783991
newValue = value;
39793992

3993+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
3994+
return object;
3995+
}
3996+
39803997
if (index != lastIndex) {
39813998
var objValue = nested[key];
39823999
newValue = customizer ? customizer(objValue, key, nested) : undefined;
@@ -4129,11 +4146,14 @@
41294146
* into `array`.
41304147
*/
41314148
function baseSortedIndexBy(array, value, iteratee, retHighest) {
4132-
value = iteratee(value);
4133-
41344149
var low = 0,
4135-
high = array == null ? 0 : array.length,
4136-
valIsNaN = value !== value,
4150+
high = array == null ? 0 : array.length;
4151+
if (high === 0) {
4152+
return 0;
4153+
}
4154+
4155+
value = iteratee(value);
4156+
var valIsNaN = value !== value,
41374157
valIsNull = value === null,
41384158
valIsSymbol = isSymbol(value),
41394159
valIsUndefined = value === undefined;
@@ -5618,10 +5638,11 @@
56185638
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
56195639
return false;
56205640
}
5621-
// Assume cyclic values are equal.
5622-
var stacked = stack.get(array);
5623-
if (stacked && stack.get(other)) {
5624-
return stacked == other;
5641+
// Check that cyclic values are equal.
5642+
var arrStacked = stack.get(array);
5643+
var othStacked = stack.get(other);
5644+
if (arrStacked && othStacked) {
5645+
return arrStacked == other && othStacked == array;
56255646
}
56265647
var index = -1,
56275648
result = true,
@@ -5783,10 +5804,11 @@
57835804
return false;
57845805
}
57855806
}
5786-
// Assume cyclic values are equal.
5787-
var stacked = stack.get(object);
5788-
if (stacked && stack.get(other)) {
5789-
return stacked == other;
5807+
// Check that cyclic values are equal.
5808+
var objStacked = stack.get(object);
5809+
var othStacked = stack.get(other);
5810+
if (objStacked && othStacked) {
5811+
return objStacked == other && othStacked == object;
57905812
}
57915813
var result = true;
57925814
stack.set(object, other);
@@ -9167,6 +9189,10 @@
91679189
* // The `_.property` iteratee shorthand.
91689190
* _.filter(users, 'active');
91699191
* // => objects for ['barney']
9192+
*
9193+
* // Combining several predicates using `_.overEvery` or `_.overSome`.
9194+
* _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
9195+
* // => objects for ['fred', 'barney']
91709196
*/
91719197
function filter(collection, predicate) {
91729198
var func = isArray(collection) ? arrayFilter : baseFilter;
@@ -9916,15 +9942,15 @@
99169942
* var users = [
99179943
* { 'user': 'fred', 'age': 48 },
99189944
* { 'user': 'barney', 'age': 36 },
9919-
* { 'user': 'fred', 'age': 40 },
9945+
* { 'user': 'fred', 'age': 30 },
99209946
* { 'user': 'barney', 'age': 34 }
99219947
* ];
99229948
*
99239949
* _.sortBy(users, [function(o) { return o.user; }]);
9924-
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
9950+
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
99259951
*
99269952
* _.sortBy(users, ['user', 'age']);
9927-
* // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
9953+
* // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
99289954
*/
99299955
var sortBy = baseRest(function(collection, iteratees) {
99309956
if (collection == null) {
@@ -14799,11 +14825,11 @@
1479914825

1480014826
// Use a sourceURL for easier debugging.
1480114827
// The sourceURL gets injected into the source that's eval-ed, so be careful
14802-
// with lookup (in case of e.g. prototype pollution), and strip newlines if any.
14803-
// A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
14828+
// to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in
14829+
// and escape the comment, thus injecting code that gets evaled.
1480414830
var sourceURL = '//# sourceURL=' +
1480514831
(hasOwnProperty.call(options, 'sourceURL')
14806-
? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
14832+
? (options.sourceURL + '').replace(/\s/g, ' ')
1480714833
: ('lodash.templateSources[' + (++templateCounter) + ']')
1480814834
) + '\n';
1480914835

@@ -14836,8 +14862,6 @@
1483614862

1483714863
// If `variable` is not specified wrap a with-statement around the generated
1483814864
// code to add the data object to the top of the scope chain.
14839-
// Like with sourceURL, we take care to not check the option's prototype,
14840-
// as this configuration is a code injection vector.
1484114865
var variable = hasOwnProperty.call(options, 'variable') && options.variable;
1484214866
if (!variable) {
1484314867
source = 'with (obj) {\n' + source + '\n}\n';
@@ -15544,6 +15568,9 @@
1554415568
* values against any array or object value, respectively. See `_.isEqual`
1554515569
* for a list of supported value comparisons.
1554615570
*
15571+
* **Note:** Multiple values can be checked by combining several matchers
15572+
* using `_.overSome`
15573+
*
1554715574
* @static
1554815575
* @memberOf _
1554915576
* @since 3.0.0
@@ -15559,6 +15586,10 @@
1555915586
*
1556015587
* _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
1556115588
* // => [{ 'a': 4, 'b': 5, 'c': 6 }]
15589+
*
15590+
* // Checking for several possible values
15591+
* _.filter(users, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
15592+
* // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
1556215593
*/
1556315594
function matches(source) {
1556415595
return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
@@ -15573,6 +15604,9 @@
1557315604
* `srcValue` values against any array or object value, respectively. See
1557415605
* `_.isEqual` for a list of supported value comparisons.
1557515606
*
15607+
* **Note:** Multiple values can be checked by combining several matchers
15608+
* using `_.overSome`
15609+
*
1557615610
* @static
1557715611
* @memberOf _
1557815612
* @since 3.2.0
@@ -15589,6 +15623,10 @@
1558915623
*
1559015624
* _.find(objects, _.matchesProperty('a', 4));
1559115625
* // => { 'a': 4, 'b': 5, 'c': 6 }
15626+
*
15627+
* // Checking for several possible values
15628+
* _.filter(users, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
15629+
* // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
1559215630
*/
1559315631
function matchesProperty(path, srcValue) {
1559415632
return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
@@ -15812,6 +15850,10 @@
1581215850
* Creates a function that checks if **all** of the `predicates` return
1581315851
* truthy when invoked with the arguments it receives.
1581415852
*
15853+
* Following shorthands are possible for providing predicates.
15854+
* Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
15855+
* Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
15856+
*
1581515857
* @static
1581615858
* @memberOf _
1581715859
* @since 4.0.0
@@ -15838,6 +15880,10 @@
1583815880
* Creates a function that checks if **any** of the `predicates` return
1583915881
* truthy when invoked with the arguments it receives.
1584015882
*
15883+
* Following shorthands are possible for providing predicates.
15884+
* Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
15885+
* Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
15886+
*
1584115887
* @static
1584215888
* @memberOf _
1584315889
* @since 4.0.0
@@ -15857,6 +15903,9 @@
1585715903
*
1585815904
* func(NaN);
1585915905
* // => false
15906+
*
15907+
* var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
15908+
* var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
1586015909
*/
1586115910
var overSome = createOver(arraySome);
1586215911

0 commit comments

Comments
 (0)