Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "arrays"

Index

Variables

Const arrayPrototype

arrayPrototype: any[] = Array.prototype

Functions

argumentsArray

  • argumentsArray<T>(argsObject: IArguments): T[]
  • Return array from arguments

    Type parameters

    • T

    Parameters

    • argsObject: IArguments

    Returns T[]

compact

  • compact<T>(array: (undefined | null | T)[]): T[]
  • Creates an array with all falsey values removed. The values false, null, 0, "", undefined, and NaN are falsey.

    Type parameters

    • T

    Parameters

    • array: (undefined | null | T)[]

      array to compact.

    Returns T[]

    Returns the new array of filtered values.

concat

  • concat<T>(...item: (T | T[])[]): T[]
  • Creates a new array concatenating array with any additional arrays and/or values.

    Type parameters

    • T

    Parameters

    • Rest ...item: (T | T[])[]

      item or array to concatenate

    Returns T[]

    Returns the new concatenated array.

contains

  • contains<T>(array: T[], item: T): boolean
  • Check if item is in array using indexOf

    Type parameters

    • T

    Parameters

    • array: T[]

      The array to inspect

    • item: T

      The item to check

    Returns boolean

    Return true if item is in array

difference

  • difference<T>(array1: T[], array2: T[]): T[]
  • Creates an symmetric difference array of values not included in the other given arrays. The order and references of result values are determined by the first array.

    Type parameters

    • T

    Parameters

    • array1: T[]

      The first array

    • array2: T[]

      The second array

    Returns T[]

    Returns values not included in the other given arrays.

filter

  • filter<T>(array: T[], callbackfn: function): T[]
  • Filter items by predicate

    Type parameters

    • T

    Parameters

    • array: T[]
    • callbackfn: function
        • (this: void, value: T, index: number, array: T[]): any
        • Parameters

          • this: void
          • value: T
          • index: number
          • array: T[]

          Returns any

    Returns T[]

flatten

  • flatten<T>(array: (T | T[])[]): T[]
  • Flattens array a single level deep.

    Type parameters

    • T

    Parameters

    • array: (T | T[])[]

      The array to flatten.

    Returns T[]

    Return Flattened array.

forEach

  • forEach<T>(array: T[], callbackfn: function): T[]
  • Iterate over array with callbackfn

    Type parameters

    • T

    Parameters

    • array: T[]
    • callbackfn: function
        • (this: void, value: T, index: number, array: T[]): any
        • Parameters

          • this: void
          • value: T
          • index: number
          • array: T[]

          Returns any

    Returns T[]

indexOf

  • indexOf<T>(array: T[], item: T): number
  • Get index of item in array

    Type parameters

    • T

    Parameters

    • array: T[]
    • item: T

    Returns number

    -1 if item is not found

isArray

  • isArray<T>(item: T | T[]): boolean
  • Check if argument is an array

    Type parameters

    • T

    Parameters

    • item: T | T[]

    Returns boolean

uniq

  • uniq<T>(array: T[]): T[]
  • Creates a duplicate-free version of an array, using indexOf for equality comparisons, in which only the first occurrence of each element is kept. The order of result values is determined by the order they occur in the array.

    Type parameters

    • T

    Parameters

    • array: T[]

      The array to inspect.

    Returns T[]

    Duplicate free array

without

  • without<T>(array: T[], remove: T[]): T[]
  • Creates an array excluding all given values using indexOf for equality comparisons.

    Type parameters

    • T

    Parameters

    • array: T[]

      The array to inspect.

    • remove: T[]

      The array to exclude.

    Returns T[]

    Returns the new array of filtered values.

Generated using TypeDoc