Skip to content

Instantly share code, notes, and snippets.

View JulianKnodt's full-sized avatar
🤺

Julian Knodt JulianKnodt

🤺
View GitHub Profile
@JulianKnodt
JulianKnodt / uniques.js
Last active July 8, 2018 06:11 — forked from kapv89/uniques.js
Perf test on various methods to extract unique elements out of an array of objects
const f = require('faker');
let dup = (a) => a.map((el) => Object.assign({}, el));
// https://stackoverflow.com/questions/6274339/how-can-i-shuffle-an-array
const shuffle = (a) => {
for (let i = a.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[a[i], a[j]] = [a[j], a[i]];
}