n-dimensional array
Internal use only -- Keeps track of recursion
const arr = [
{label: null, url: '/'},
{label: 'Model Admin', url: '/model-admin'},
[
{label: 'Elements', url: '/model-admin/elements'},
{label: 'Example', url: null}
]
];
console.log(flattenArr(arr));
// Output:
[
{label: null, url: '/'},
{label: 'Model Admin', url: '/model-admin'},
{label: 'Elements', url: '/model-admin/elements'},
{label: 'Example', url: null}
]
Recursively flatten nested arrays