Restore createAssigner (fixes compilation of merge and mergeWith) (#4101)

This commit is contained in:
Luiz Américo
2018-12-05 02:09:54 -02:00
committed by John-David Dalton
parent 508d46a7a4
commit 8eccdd098a
2 changed files with 65 additions and 0 deletions

View 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