mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
Restore createAssigner (fixes compilation of merge and mergeWith) (#4101)
This commit is contained in:
committed by
John-David Dalton
parent
508d46a7a4
commit
8eccdd098a
29
.internal/isIterateeCall.js
Normal file
29
.internal/isIterateeCall.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import isArrayLike from '../isArrayLike.js'
|
||||
import isIndex from './isIndex.js'
|
||||
|
||||
/**
|
||||
* Checks if the given arguments are from an iteratee call.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The potential iteratee value argument.
|
||||
* @param {*} index The potential iteratee index or key argument.
|
||||
* @param {*} object The potential iteratee object argument.
|
||||
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
|
||||
* else `false`.
|
||||
*/
|
||||
|
||||
function isIterateeCall(value, index, object) {
|
||||
if (!isObject(object)) {
|
||||
return false;
|
||||
}
|
||||
const type = typeof index;
|
||||
if (type == 'number'
|
||||
? (isArrayLike(object) && isIndex(index, object.length))
|
||||
: (type == 'string' && index in object)
|
||||
) {
|
||||
return eq(object[index], value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export default isIterateeCall
|
||||
Reference in New Issue
Block a user