export function unique < T > ( array ) { return Array . from ( new Set ( array ) ) ; } export function flatten < T > ( nestedArrays ) { return [ ] . concat ( ... nestedArrays ) ; } export function shuffle < T > ( array ) { for ( let i = array . length - 1 ; i > 0 ; i -- ) { const j = Math . floor ( Math . random ( ) * ( i + 1 ) ) ; const temp = array [ i ] ; array [ i ] = array [ j ] ; array [ j ] = temp ; } return array ; }