{"version":3,"file":"findIndex.cjs","names":[],"sources":["../../src/array/findIndex.ts"],"sourcesContent":["/**\n * Finds the index of the first element that matches the predicate\n * @param array The array to search\n * @param predicate The function to test each element\n * @returns The index of the first matching element, or -1 if not found\n * @example\n * findIndex([1, 2, 3, 4], (item) => item > 2); // 2\n * findIndex([1, 2, 3], (item) => item > 5); // -1\n */\nexport function findIndex<T>(array: T[], predicate: (item: T, index: number) => boolean): number {\n  if (!Array.isArray(array)) {\n    return -1;\n  }\n\n  for (let i = 0; i < array.length; i++) {\n    if (predicate(array[i], i)) {\n      return i;\n    }\n  }\n\n  return -1;\n}\n"],"mappings":";;;;;;;;;;;AASA,SAAgB,UAAa,OAAY,WAAwD;CAC/F,IAAI,CAAC,MAAM,QAAQ,KAAK,GACtB,OAAO;CAGT,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAChC,IAAI,UAAU,MAAM,IAAI,CAAC,GACvB,OAAO;CAIX,OAAO;AACT"}