mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 01:17:50 +00:00
Bump to v3.6.0.
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import arrayEach from '../internal/arrayEach';
|
||||
import baseEach from '../internal/baseEach';
|
||||
import bindCallback from '../internal/bindCallback';
|
||||
import isArray from '../lang/isArray';
|
||||
import createForEach from '../internal/createForEach';
|
||||
|
||||
/**
|
||||
* Iterates over elements of `collection` invoking `iteratee` for each element.
|
||||
* The `iteratee` is bound to `thisArg` and invoked with three arguments;
|
||||
* The `iteratee` is bound to `thisArg` and invoked with three arguments:
|
||||
* (value, index|key, collection). Iterator functions may exit iteration early
|
||||
* by explicitly returning `false`.
|
||||
*
|
||||
@@ -33,10 +32,6 @@ import isArray from '../lang/isArray';
|
||||
* });
|
||||
* // => logs each value-key pair and returns the object (iteration order is not guaranteed)
|
||||
*/
|
||||
function forEach(collection, iteratee, thisArg) {
|
||||
return (typeof iteratee == 'function' && typeof thisArg == 'undefined' && isArray(collection))
|
||||
? arrayEach(collection, iteratee)
|
||||
: baseEach(collection, bindCallback(iteratee, thisArg, 3));
|
||||
}
|
||||
var forEach = createForEach(arrayEach, baseEach);
|
||||
|
||||
export default forEach;
|
||||
|
||||
Reference in New Issue
Block a user