example export function flatten < T > ( array ) { const flat = [ ] ; for ( const maybeArray of array ) { if ( Array . isArray ( maybeArray ) ) { flat . push ( ... flatten ( maybeArray ) ) ; } else { flat . push ( maybeArray ) ; } } return flat ; }