flattenDeep

array

Recursively flattens array to a single level.

Signature

flattenDeep<T>(array: T[]): any[]

Parameters

NameTypeDescription
arrayT[]The array to flatten

Returns

any[] - Returns the new flattened array

Examples

Basic Usage

import { flattenDeep } from 'dashlite'

const result = flattenDeep([1, [2, [3, [4]], 5]])
console.log(result)

Output:

[1, 2, 3, 4, 5]

Available since version 1.0.0