8000 Bump to v3.9.0. · lodash/lodash@81e41ca · GitHub
[go: up one dir, main page]

Skip to content

Commit 81e41ca

Browse files
committed
Bump to v3.9.0.
1 parent 26837e7 commit 81e41ca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+1029
-1084
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# lodash v3.8.0
1+
# lodash v3.9.0
22

33
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) modules.
44

@@ -13,8 +13,8 @@ $ lodash modern exports=amd -d -o ./main.js
1313
Using bower or volo:
1414

1515
```bash
16-
$ bower i lodash#3.8.0-amd
17-
$ volo add lodash/3.8.0-amd
16+
$ bower i lodash#3.9.0-amd
17+
$ volo add lodash/3.9.0-amd
1818
```
1919

2020
Defining a build as `'lodash'`.

array/intersection.js

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
define(['../internal/baseIndexOf', '../internal/cacheIndexOf', '../internal/createCache', '../internal/isArrayLike'], function(baseIndexOf, cacheIndexOf, createCache, isArrayLike) {
1+
define(['../internal/baseIndexOf', '../internal/cacheIndexOf', '../internal/createCache', '../internal/isArrayLike', '../function/restParam'], function(baseIndexOf, cacheIndexOf, createCache, isArrayLike, restParam) {
22

33
/**
44
* Creates an array of unique values in all provided arrays using
@@ -14,27 +14,19 @@ define(['../internal/baseIndexOf', '../internal/cacheIndexOf', '../internal/crea
1414
* _.intersection([1, 2], [4, 2], [2, 1]);
1515
* // => [2]
1616
*/
17-
function intersection() {
18-
var args = [],
19-
argsIndex = -1,
20-
argsLength = arguments.length,
21-
caches = [],
17+
var intersection = restParam(function(arrays) {
18+
var othLength = arrays.length,
19+
othIndex = othLength,
20+
caches = Array(length),
2221
indexOf = baseIndexOf,
2322
isCommon = true,
2423
result = [];
2524

26-
while (++argsIndex < argsLength) {
27-
var value = arguments[argsIndex];
28-
if (isArrayLike(value)) {
29-
args.push(value);
30-
caches.push((isCommon && value.length >= 120) ? createCache(argsIndex && value) : null);
31-
}
32-
}
33-
argsLength = args.length;
34-
if (argsLength < 2) {
35-
return result;
25+
while (othIndex--) {
26+
var value = arrays[othIndex] = isArrayLike(value = arrays[othIndex]) ? value : [];
27+
caches[othIndex] = (isCommon && value.length >= 120) ? createCache(othIndex && value) : null;
3628
}
37-
var array = args[0],
29+
var array = arrays[0],
3830
index = -1,
3931
length = array ? array.length : 0,
4032
seen = caches[0];
@@ -43,10 +35,10 @@ define(['../internal/baseIndexOf', '../internal/cacheIndexOf', '../internal/crea
4335
while (++index < length) {
4436
value = array[index];
4537
if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value, 0)) < 0) {
46-
argsIndex = argsLength;
47-
while (--argsIndex) {
48-
var cache = caches[argsIndex];
49-
if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value, 0)) < 0) {
38+
var othIndex = othLength;
39+
while (--othIndex) {
40+
var cache = caches[othIndex];
41+
if ((cache ? cacheIndexOf(cache, value) : indexOf(arrays[othIndex], value, 0)) < 0) {
5042
continue outer;
5143
}
5244
}
@@ -57,7 +49,7 @@ define(['../internal/baseIndexOf', '../internal/cacheIndexOf', '../internal/crea
5749
}
5850
}
5951
return result;
60-
}
52+
});
6153

6254
return intersection;
6355
});

array/zipWith.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ define(['../function/restParam', './unzipWith'], function(restParam, unzipWith)
2222
*/
2323
var zipWith = restParam(function(arrays) {
2424
var length = arrays.length,
25-
iteratee = arrays[length - 2],
26-
thisArg = arrays[length - 1];
25+
iteratee = length > 2 ? arrays[length - 2] : undefined,
26+
thisArg = length > 1 ? arrays[length - 1] : undefined;
2727

2828
if (length > 2 && typeof iteratee == 'function') {
2929
length -= 2;

chain/lodash.js

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,30 +45,31 @@ define(['../internal/LazyWrapper', '../internal/LodashWrapper', '../internal/bas
4545
* `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`, `forEach`,
4646
* `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `functions`,
4747
* `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`,
48-
* `keysIn`, `map`, `mapValues`, `matches`, `matchesProperty`, `memoize`,
49-
* `merge`, `mixin`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`,
50-
* `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`,
51-
* `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `reverse`,
52-
* `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`, `sortByOrder`, `splice`,
53-
* `spread`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`,
54-
* `throttle`, `thru`, `times`, `toArray`, `toPlainObject`, `transform`,
55-
* `union`, `uniq`, `unshift`, `unzip`, `values`, `valuesIn`, `where`,
56-
* `without`, `wrap`, `xor`, `zip`, and `zipObject`
48+
* `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
49+
* `memoize`, `merge`, `method`, `methodOf`, `mixin`, `negate`, `omit`, `once`,
50+
* `pairs`, `partial`, `partialRight`, `partition`, `pick`, `plant`, `pluck`,
51+
* `property`, `propertyOf`, `pull`, `pullAt`, `push`, `range`, `rearg`,
52+
* `reject`, `remove`, `rest`, `restParam`, `reverse`, `set`, `shuffle`,
53+
* `slice`, `sort`, `sortBy`, `sortByAll`, `sortByOrder`, `splice`, `spread`,
54+
* `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, `throttle`,
55+
* `thru`, `times`, `toArray`, `toPlainObject`, `transform`, `union`, `uniq`,
56+
* `unshift`, `unzip`, `unzipWith`, `values`, `valuesIn`, `where`, `without`,
57+
* `wrap`, `xor`, `zip`, `zipObject`, `zipWith`
5758
*
5859
* The wrapper methods that are **not** chainable by default are:
5960
* `add`, `attempt`, `camelCase`, `capitalize`, `clone`, `cloneDeep`, `deburr`,
6061
* `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`,
61-
* `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, `has`,
62-
* `identity`, `includes`, `indexOf`, `inRange`, `isArguments`, `isArray`,
63-
* `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`, `isFinite`
64-
* `isFunction`, `isMatch`, `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`,
65-
* `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `isTypedArray`,
66-
* `join`, `kebabCase`, `last`, `lastIndexOf`, `max`, `min`, `noConflict`,
67-
* `noop`, `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`,
68-
* `reduce`, `reduceRight`, `repeat`, `result`, `runInContext`, `shift`, `size`,
69-
* `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`, `startsWith`,
70-
* `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`, `unescape`,
71-
* `uniqueId`, `value`, and `words`
62+
* `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, `get`,
63+
* `gt`, `gte`, `has`, `identity`, `includes`, `indexOf`, `inRange`, `isArguments`,
64+
* `isArray`, `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`,
65+
* `isFinite` `isFunction`, `isMatch`, `isNative`, `isNaN`, `isNull`, `isNumber`,
66+
* `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`,
67+
* `isTypedArray`, `join`, `kebabCase`, `last`, `lastIndexOf`, `lt`, `lte`,
68+
* `max`, `min`, `noConflict`, `noop`, `now`, `pad`, `padLeft`, `padRight`,
69+
* `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`,
70+
* `runInContext`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`,
71+
* `sortedLastIndex`, `startCase`, `startsWith`, `sum`, `template`, `trim`,
72+
* `trimLeft`, `trimRight`, `trunc`, `unescape`, `uniqueId`, `value`, and `words`
7273
*
7374
* The wrapper method `sample` will return a wrapped value when `n` is provided,
7475
* otherwise an unwrapped value is returned.

collection/invoke.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
define(['../internal/baseEach', '../internal/invokePath', '../internal/isArrayLike', '../internal/isKey', '../function/restParam'], function(baseEach, invokePath, isArrayLike, isKey, restParam) {
22

33
/**
4-
* Invokes the method at `path` on each element in `collection`, returning
4+
* Invokes the method at `path` of each element in `collection`, returning
55
* an array of the results of each invoked method. Any additional arguments
66
* are provided to each invoked method. If `methodName` is a function it is
77
* invoked for, and `this` bound to, each element in `collection`.
@@ -29,7 +29,7 @@ define(['../internal/baseEach', '../internal/invokePath', '../internal/isArrayLi
2929
result = isArrayLike(collection) ? Array(collection.length) : [];
3030

3131
baseEach(collection, function(value) {
32-
var func = isFunc ? path : (isProp && value != null && value[path]);
32+
var func = isFunc ? path : ((isProp && value != null) ? value[path] : null);
3333
result[++index] = func ? func.apply(value, args) : invokePath(value, path, args);
3434
});
3535
return result;

collection/map.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ define(['../internal/arrayMap', '../internal/baseCallback', '../internal/baseMap
1616
* callback returns `true` for elements that have the properties of the given
1717
* object, else `false`.
1818
*
19-
* Many lodash methods are guarded to work as interatees for methods like
19+
* Many lodash methods are guarded to work as iteratees for methods like
2020
* `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
2121
*
2222
* The guarded methods are:

collection/reduce.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ define(['../internal/arrayReduce', '../internal/baseEach', '../internal/createRe
88
* value. The `iteratee` is bound to `thisArg` and invoked with four arguments:
99
* (accumulator, value, index|key, collection).
1010
*
11-
* Many lodash methods are guarded to work as interatees for methods like
11+
* Many lodash methods are guarded to work as iteratees for methods like
1212
* `_.reduce`, `_.reduceRight`, and `_.transform`.
1313
*
1414
* The guarded methods are:

date/now.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
define(['../lang/isNative'], function(isNative) {
1+
define(['../internal/getNative'], function(getNative) {
22

33
/* Native method references for those with the same name as other `lodash` methods. */
4-
var nativeNow = isNative(nativeNow = Date.now) && nativeNow;
4+
var nativeNow = getNative(Date, 'now');
55

66
/**
77
* Gets the number of milliseconds that have elapsed since the Unix epoch

function/debounce.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ define(['../lang/isObject', '../date/now'], function(isObject, now) {
1010
var nativeMax = Math.max;
1111

1212
/**
13-
* Creates a function that delays invoking `func` until after `wait` milliseconds
14-
* have elapsed since the last time it was invoked. The created function comes
15-
* with a `cancel` method to cancel delayed invocations. Provide an options
16-
* object to indicate that `func` should be invoked on the leading and/or
17-
* trailing edge of the `wait` timeout. Subsequent calls to the debounced
18-
* function return the result of the last `func` invocation.
13+
* Creates a debounced function that delays invoking `func` until after `wait`
14+
* milliseconds have elapsed since the last time the debounced function was
15+
* invoked. The debounced function comes with a `cancel` method to cancel
16+
* delayed invocations. Provide an options object to indicate that `func`
17+
* should be invoked on the leading and/or trailing edge of the `wait` timeout.
18+
* Subsequent calls to the debounced function return the result of the last
19+
* `func` invocation.
1920
*
2021
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
2122
* on the trailing edge of the timeout only if the the debounced function is

function/memoize.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ define(['../internal/MapCache'], function(MapCache) {
6060
}
6161
var memoized = function() {
6262
var args = arguments,
63-
cache = memoized.cache,
64-
key = resolver ? resolver.apply(this, args) : args[0];
63+
key = resolver ? resolver.apply(this, args) : args[0],
64+
cache = memoized.cache;
6565

6666
if (cache.has(key)) {
6767
return cache.get(key);
6868
}
6969
var result = func.apply(this, args);
70-
cache.set(key, result);
70+
memoized.cache = cache.set(key, result);
7171
return result;
7272
};
7373
memoized.cache = new memoize.Cache;

0 commit comments

Comments
 (0)
0