Options
All
  • Public
  • Public/Protected
  • All
Menu

Module array/flatten

Index

References

Functions

References

Renames and re-exports flatten

Functions

  • flatten<T>(arr?: ArrayLike<any>): T[]
  • Returns a new list by pulling every item out of it (and all its sub-arrays) and putting them in a new array, depth-first.

    example
     flatten([1, 2, [3, 4], 5, [6, [7, 8, [9, [10, 11], 12]]]]);
    //=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]

    Type parameters

    • T

    Parameters

    • arr: ArrayLike<any> = []

      The array to consider.

    Returns T[]

    The flattened list.

Generated using TypeDoc