Closed ericcarraway closed 8 years ago
/**
* Filter from the input values contained in the filter arr
* @param {array} inputArr - an unfiltered array
* @param {array} filterArr - an array of values to filter out
* @return {array}
*/
var filterByArr = function (inputArr, filterArr) {
// return false if input is in the filterArr
// return true if input is NOT in the filterArr
var isAllowed = function (input) {
return filterArr.indexOf(input) === -1;
};
return inputArr.filter(isAllowed);
};
https://lodash.com/docs
_.difference(array, [values])