param array returns export function flattenArray ( array ) { const flattenedArray = [ ] . concat ( ... array ) ; return flattenedArray . some ( Array . isArray ) ? flattenArray ( flattenedArray ) : flattenedArray ; }