Options
All
  • Public
  • Public/Protected
  • All
Menu

Module utils/ArrayUtils

Functions

matchIfDefined

  • matchIfDefined(value: any, array: any[]): boolean
  • Returns true if the value is undefined or appears in the array.

    Parameters

    • value: any

      Value

    • array: any[]

      Array

    Returns boolean

mismatch

  • mismatch(value: any, array: any[]): boolean
  • Returns true if the value is defined and does not appear in the array.

    Parameters

    • value: any

      Value

    • array: any[]

      Array

    Returns boolean

moveArrayItem

  • moveArrayItem(arr: any[], from: number, to: number): any[]
  • Moves one item of an array in place and returns the mutated array.

    Parameters

    • arr: any[]

      Array

    • from: number

      Index of item to move

    • to: number

      Index to move it to

    Returns any[]

randomlyPick

  • randomlyPick<T>(input: T[]): T
  • Randomly selects one item from an array with uniform probability.

    Type parameters

    • T

    Parameters

    • input: T[]

    Returns T