Options
All
  • Public
  • Public/Protected
  • All
Menu

Module includes

Index

References

Functions Collection

References

Renames and re-exports includes

Collection Functions

  • includes<T>(collection: ArrayLike<T> | Record<string, T>, value: T, fromIndex?: number, guard?: any): boolean
  • Checks if value is in collection. If collection is a string, it's checked for a substring of value, otherwise SameValueZero is used for equality comparisons. If fromIndex is negative, it's used as the offset from the end of collection.

    since

    5.12.0

    param-

    {Object} [guard] Enables use as an iteratee for methods like reduce.

    example
    includes([1, 2, 3], 1);
    // => true

    includes([1, 2, 3], 1, 2);
    // => false

    includes({ 'a': 1, 'b': 2 }, 1);
    // => true

    includes('abcd', 'bc');
    // => true

    Type parameters

    • T = any

    Parameters

    • collection: ArrayLike<T> | Record<string, T>

      The collection to inspect.

    • value: T

      The value to search for.

    • Optional fromIndex: number
    • Optional guard: any

    Returns boolean

    Returns true if value is found, else false.