Options
All
  • Public
  • Public/Protected
  • All
Menu

A class which provides some operations on Array

export
class

Arrays

Hierarchy

  • Arrays

Index

Methods

Static add

  • add(src: any[], value: any, index: number): boolean
  • Provides to add the given item to the given array by index.

    Parameters

    • src: any[]
    • value: any
    • index: number

    Returns boolean

Static forEach

  • forEach(array: any[], callback: function): boolean
  • Provides to navigate in the given Object and can broken if return false from callback function.

    Parameters

    • array: any[]
    • callback: function
        • (item: any, index?: number, obj?: Props): boolean | void
        • Parameters

          • item: any
          • Optional index: number
          • Optional obj: Props

          Returns boolean | void

    Returns boolean

Static getLength

  • getLength(src: any[]): number
  • Gets length of the given array.

    Parameters

    • src: any[]

    Returns number

Static has

  • has(src: any[], index?: number): boolean
  • Checks the given array is exist or not or index is exist or not.

    Parameters

    • src: any[]
    • Optional index: number

    Returns boolean

Static indexOf

  • indexOf<T>(data: T[], searchElement: T, fromIndex?: number): number
  • Returns the index of the last occurrence of a specified value in an array.

    Type parameters

    Parameters

    • data: T[]

      The given array to be searched.

    • searchElement: T

      The value to locate in the array.

    • Optional fromIndex: number

      The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.

    Returns number

Static lastIndexOf

  • lastIndexOf<T>(data: T[], searchElement: T, fromIndex?: number): number
  • Returns the index of the first occurrence of a value in an array.

    Type parameters

    Parameters

    • data: T[]

      The given array to be searched.

    • searchElement: T

      The value to locate in the array.

    • Optional fromIndex: number

      The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.

    Returns number

Static map

  • map<T>(array: any[], callback: function): T[]
  • Provides to navigate in the given Object and create an array from the result of the callback function. if the result of the callback is empty then ignores it.

    Type parameters

    • T

    Parameters

    • array: any[]
    • callback: function
        • (item: any, index?: number, obj?: Props): T
        • Parameters

          • item: any
          • Optional index: number
          • Optional obj: Props

          Returns T

    Returns T[]

Static merge

  • merge(...arrays: any[][]): any[]
  • Merges the given arrays.

    Parameters

    • Rest ...arrays: any[][]

    Returns any[]

Static pushAll

  • pushAll(src: any[], destination: any[]): any[]
  • Provides to push the given src array to the destination array.

    Parameters

    • src: any[]
    • destination: any[]

    Returns any[]

Static remove

  • remove(src: any[], index: number): any[]
  • Removes value by the given index from the given array

    Parameters

    • src: any[]
    • index: number

    Returns any[]

Static removeAll

  • removeAll<T>(src: T[], dest: T[]): T[]
  • Provides to removes the given source array to the given destination array.

    Type parameters

    • T

    Parameters

    • src: T[]
    • dest: T[]

    Returns T[]

Static removeValue

  • removeValue(src: any[], value: any): any[]
  • Removes value from the given array

    Parameters

    • src: any[]
    • value: any

    Returns any[]

Generated using TypeDoc