Skip to content

Instantly share code, notes, and snippets.

@UncleBill
Created October 16, 2015 08:15
Show Gist options
  • Save UncleBill/ec3825474ca8dc1ed76c to your computer and use it in GitHub Desktop.
Save UncleBill/ec3825474ca8dc1ed76c to your computer and use it in GitHub Desktop.
function uniqueArr(arr, juggfunc) {
var resArr = [];
var has = false;
for (var i = 0; i < arr.length; ++i) {
for (var j = 0; j < resArr.length; ++j) {
if( juggfunc(resArr[j], arr[i]) ){
has = true;
}
}
if (has) {
has = false;
continue;
}
resArr.push(arr[i]);
has = false;
}
return resArr;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment