mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 18:07:49 +00:00
Add iteratee arity hints to forEach methods. [closes #2277]
This commit is contained in:
18
lodash.js
18
lodash.js
@@ -8500,9 +8500,8 @@
|
||||
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
|
||||
*/
|
||||
function forEach(collection, iteratee) {
|
||||
return (typeof iteratee == 'function' && isArray(collection))
|
||||
? arrayEach(collection, iteratee)
|
||||
: baseEach(collection, getIteratee(iteratee));
|
||||
var func = isArray(collection) ? arrayEach : baseEach;
|
||||
return func(collection, getIteratee(iteratee, 3));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -8526,9 +8525,8 @@
|
||||
* // => Logs `2` then `1`.
|
||||
*/
|
||||
function forEachRight(collection, iteratee) {
|
||||
return (typeof iteratee == 'function' && isArray(collection))
|
||||
? arrayEachRight(collection, iteratee)
|
||||
: baseEachRight(collection, getIteratee(iteratee));
|
||||
var func = isArray(collection) ? arrayEachRight : baseEachRight;
|
||||
return func(collection, getIteratee(iteratee, 3));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -12103,7 +12101,7 @@
|
||||
function forIn(object, iteratee) {
|
||||
return object == null
|
||||
? object
|
||||
: baseFor(object, getIteratee(iteratee), keysIn);
|
||||
: baseFor(object, getIteratee(iteratee, 3), keysIn);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -12135,7 +12133,7 @@
|
||||
function forInRight(object, iteratee) {
|
||||
return object == null
|
||||
? object
|
||||
: baseForRight(object, getIteratee(iteratee), keysIn);
|
||||
: baseForRight(object, getIteratee(iteratee, 3), keysIn);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -12167,7 +12165,7 @@
|
||||
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
|
||||
*/
|
||||
function forOwn(object, iteratee) {
|
||||
return object && baseForOwn(object, getIteratee(iteratee));
|
||||
return object && baseForOwn(object, getIteratee(iteratee, 3));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -12197,7 +12195,7 @@
|
||||
* // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
|
||||
*/
|
||||
function forOwnRight(object, iteratee) {
|
||||
return object && baseForOwnRight(object, getIteratee(iteratee));
|
||||
return object && baseForOwnRight(object, getIteratee(iteratee, 3));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user