source: node_modules/es-toolkit/dist/compat/array/includes.d.mts@ ba17441

Last change on this file since ba17441 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 906 bytes
Line 
1/**
2 * Checks if a specified value exists within a given array-like collection.
3 *
4 * The comparison uses SameValueZero to check for inclusion.
5 *
6 * @template T The type of elements in the collection
7 * @param collection The array-like collection to search in
8 * @param target The value to search for in the collection
9 * @param [fromIndex=0] The index to start searching from. If negative, it is treated as an offset from the end
10 * @returns `true` if the value is found in the collection, `false` otherwise
11 *
12 * @example
13 * includes([1, 2, 3], 2); // true
14 * includes([1, 2, 3], 4); // false
15 * includes('hello', 'e'); // true
16 * includes(null, 1); // false
17 * includes([1, 2, 3], 2, 2); // false
18 * includes([1, 2, 3], 2, -2); // true
19 */
20declare function includes<T>(collection: Record<string, T> | Record<number, T> | null | undefined, target: T, fromIndex?: number): boolean;
21
22export { includes };
Note: See TracBrowser for help on using the repository browser.