• Flattens an array of elements by recursively traversing the array and concatenating any nested arrays found.

    Type Parameters

    • T = unknown

    Parameters

    • list: T[]

      The array to be flattened.

    Returns T[]

    • The flattened array.

    Example

    console.log(flattenArray([1, 2, [3, 4]])); // [1, 2, 3, 4]
    

Generated using TypeDoc