export function arrayUnique(array) { return Array.from((new Set(array)).values()); } export function flatten(array) { return [].concat.apply([], array) } export function fromObject(object) { const array = []; for (const key in object) { array.push(object[key]); } return array; } export function shuffle(array) { const shuffled = [...array]; shuffleInPlace(shuffled); return shuffled; } export function shuffleInPlace(array) { let i = 0, j = 0, temp = null; for (i = array.length - 1; i > 0; i -= 1) { j = Math.floor(Math.random() * (i + 1)) temp = array[i] array[i] = array[j] array[j] = temp } }