Options
All
  • Public
  • Public/Protected
  • All
Menu

Module array/includes

Index

References

Functions

References

Renames and re-exports includes

Functions

  • includes(value: string, array: string): boolean
  • includes<T>(value: T, array: ArrayLike<T>): boolean
  • includes<T>(value: T): (array: string | ArrayLike<T>) => boolean
  • Dispatches call to arr.indexOf, returns true if arr is array and value in the array or if arr is string and value is substring of arr

    example
     includes(3, [1, 2, 3]);       //=> true
    includes(4, [1, 2, 3]); //=> false
    includes('test', 'aaatest'); //=> true

    Parameters

    • value: string

      The item to compare against.

    • array: string

    Returns boolean

    true if the item is in the list, false otherwise.

  • Dispatches call to arr.indexOf, returns true if arr is array and value in the array or if arr is string and value is substring of arr

    example
     includes(3, [1, 2, 3]);       //=> true
    includes(4, [1, 2, 3]); //=> false
    includes('test', 'aaatest'); //=> true

    Type parameters

    • T

    Parameters

    • value: T

      The item to compare against.

    • array: ArrayLike<T>

    Returns boolean

    true if the item is in the list, false otherwise.

  • Dispatches call to arr.indexOf, returns true if arr is array and value in the array or if arr is string and value is substring of arr

    example
     includes(3, [1, 2, 3]);       //=> true
    includes(4, [1, 2, 3]); //=> false
    includes('test', 'aaatest'); //=> true

    Type parameters

    • T

    Parameters

    • value: T

      The item to compare against.

    Returns (array: string | ArrayLike<T>) => boolean

    true if the item is in the list, false otherwise.

      • (array: string | ArrayLike<T>): boolean
      • Parameters

        • array: string | ArrayLike<T>

        Returns boolean

Generated using TypeDoc