Skip to content

Instantly share code, notes, and snippets.

@kaiquewdev
Created October 16, 2014 04:11
Show Gist options
  • Save kaiquewdev/e4c05c63be7c8687d233 to your computer and use it in GitHub Desktop.
Save kaiquewdev/e4c05c63be7c8687d233 to your computer and use it in GitHub Desktop.
Remove an list of itens from and array
function withoutHandler(arr, remove) {
var out = [];
var unwhiteList = [];
function _removeMapHandler(current) {
unwhiteList.push(arr.indexOf(current));
}
remove
.map(_removeMapHandler);
function _arrHandler(current, idx) {
var hasNoItem = unwhiteList.indexOf(idx) === -1;
if (hasNoItem) {
return current;
}
}
out = arr.filter(_arrHandler);
return out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment