Internal lodash utility that detects iteratee callback invocation patterns for method chaining and array/object iteration.
npx @tessl/cli install tessl/npm-lodash--isiterateecall@3.0.0Internal lodash utility function that determines whether provided arguments are from an iteratee call in the context of lodash operations. This function analyzes callback invocation patterns to enable lodash's method chaining and iteratee detection system.
npm install lodash._isiterateecallconst isIterateeCall = require('lodash._isiterateecall');const isIterateeCall = require('lodash._isiterateecall');
// Check if arguments match iteratee call pattern
const users = [{ name: 'Alice' }, { name: 'Bob' }];
// These would return true in an iteratee context:
// isIterateeCall(user, 0, users) => true (when called from array method)
// isIterateeCall(user, 'name', userObject) => true (when called from object method)
// Direct calls typically return false:
const result1 = isIterateeCall({ name: 'Alice' }, 0, users);
// => false (not from iteratee context)
const result2 = isIterateeCall('value', 'key', { key: 'value' });
// => true (matches object property pattern)
const result3 = isIterateeCall('different', 'key', { key: 'value' });
// => false (value doesn't match object[key])Determines whether three arguments represent a callback invocation pattern from lodash iteration methods like map, filter, and forEach.
/**
* Checks if the provided arguments are from an iteratee call.
*
* @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)Detection Logic:
The function performs several validation checks:
object[index], handling NaN cases correctlyUsage Examples:
const isIterateeCall = require('lodash._isiterateecall');
// Array-like iteratee patterns
const arr = ['a', 'b', 'c'];
isIterateeCall('a', 0, arr); // => true
isIterateeCall('b', 1, arr); // => true
isIterateeCall('wrong', 0, arr); // => false
// Object iteratee patterns
const obj = { x: 10, y: 20 };
isIterateeCall(10, 'x', obj); // => true
isIterateeCall(20, 'y', obj); // => true
isIterateeCall(30, 'x', obj); // => false
// NaN handling
const nanObj = { prop: NaN };
isIterateeCall(NaN, 'prop', nanObj); // => true (special NaN comparison)
// Invalid cases
isIterateeCall('any', 'key', null); // => false (null object)
isIterateeCall('any', -1, arr); // => false (invalid index)
isIterateeCall('any', 'missing', obj); // => false (key doesn't exist)Edge Cases:
value === value ? (value === other) : (other !== other)) to correctly handle NaN comparisonsThis function is essential for lodash's internal operation, enabling the library to distinguish between direct function calls and callback invocations from iteration methods, which is crucial for proper method chaining and iteratee behavior.