includes
includes<
T>(iterable,item,comparator?):boolean
Defined in: packages/core/src/iterable/includes.ts:19
Checks whether item occurs in iterable.
Named for the semantics it implements: sameValueZero by default, which is
what Array.prototype.includes and Set.prototype.has both use, and unlike
indexOf it finds NaN.
Time complexity: O(n), short-circuiting on the first match.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”iterable
Section titled “iterable”Iterable<T>
The iterable to search.
T
The item to search for.
comparator?
Section titled “comparator?”EqualityComparator<T, T> = ...
The equality comparison function to use (default is
isEqual with “sameValueZero” strategy, the same as
Array.prototype.includes).
Returns
Section titled “Returns”boolean
true if a matching item was found, false otherwise.