Components Interactions Examples Tutorials API FAQ
Options
Menu

Module Array

Index

Functions

add

  • add(aList: number[], bList: number[]): number[]
  • Takes two arrays of numbers and adds them together

    Parameters

    • aList: number[]

      The first array of numbers

    • bList: number[]

      The second array of numbers

    Returns number[]

    An array of numbers where x[i] = aList[i] + bList[i]

createFilledArray

  • createFilledArray<T>(value: T | function, count: number): T[]
  • Creates an array of length count, filled with value or (if value is a function), value()

    Type parameters

    • T

    Parameters

    • value: T | function

      The value to fill the array with or a value generator (called with index as arg)

    • count: number

      The length of the array to generate

    Returns T[]

flatten

  • flatten<T>(a: T[]): T[]
  • Type parameters

    • T

    Parameters

    • a: T[]

      The 2D array that will have its elements joined together.

    Returns T[]

    Every array in a, concatenated together in the order they appear.

uniq

  • uniq<T>(arr: T[]): T[]
  • Take an array of values, and return the unique values. Will work iff ∀ a, b, a.toString() == b.toString() => a == b; will break on Object inputs

    Type parameters

    • T

    Parameters

    • arr: T[]

    Returns T[]

    The unique values

Generated using TypeDoc