Options
All
  • Public
  • Public/Protected
  • All
Menu

Utilities to perform common array operations

Hierarchy

  • ArrayUtils

Index

Methods

Static getDuplicateElements

  • getDuplicateElements(array: any[]): any[]
  • Get all the duplicate values on the provided array Duplicate values with different data types won't be considered as equal ('1', 1 will return false)

    Parameters

    • array: any[]

      An array containing some elements to test

    Returns any[]

    list with all the elements that are duplicated on the provided array

Static hasDuplicateElements

  • hasDuplicateElements(array: any[]): boolean
  • Check if the given array contains duplicate values or not. Duplicate values with different data types won't be considered as equal ('1', 1 will return false)

    Parameters

    • array: any[]

      An array containing some elements to test

    Returns boolean

    True if there are duplicate values, false otherwise

Static isArray

  • isArray(value: any): boolean
  • Tells if the given value is an array or not

    Parameters

    • value: any

      A value to check

    Returns boolean

    true if the given value is an array, false otherwise

Static isEqualTo

  • isEqualTo(array1: any[], array2: any[]): boolean
  • Check if two provided arrays are identical (have exactly the same elements and in the same order).

    Parameters

    • array1: any[]

      First array to compare

    • array2: any[]

      Second array to compare

    Returns boolean

    true if arrays are exactly the same, false if not

Static removeDuplicateElements

  • removeDuplicateElements(array: any[]): any[]
  • remove all the duplicate values on the provided array Duplicate values with different data types won't be considered as equal ('1', 1 will not be removed)

    Parameters

    • array: any[]

      An array with possible duplicate values

    Returns any[]

    The same provided array but without duplicate elements

Static removeElement

  • removeElement(array: any[], element: any): any[]
  • Remove the specified item from an array

    Parameters

    • array: any[]

      An array (it will not be modified by this method)

    • element: any

      The element that must be removed from the given array

    Returns any[]

    The provided array but without the specified element (if found). Note that originally received array is not modified by this method

Generated using TypeDoc