es-toolkit
Version:
A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.
13 lines (12 loc) • 563 B
JavaScript
import { eq } from "../util/eq.mjs";
import { isArrayLike } from "../predicate/isArrayLike.mjs";
import { isObject } from "../predicate/isObject.mjs";
import { isIndex } from "./isIndex.mjs";
//#region src/compat/_internal/isIterateeCall.ts
function isIterateeCall(value, index, object) {
if (!isObject(object)) return false;
if (typeof index === "number" && isArrayLike(object) && isIndex(index) && index < object.length || typeof index === "string" && index in object) return eq(object[index], value);
return false;
}
//#endregion
export { isIterateeCall };