Skip to content

Instantly share code, notes, and snippets.

View peterruijter's full-sized avatar

Peter Ruijter peterruijter

View GitHub Profile
@peterruijter
peterruijter / multiFilter.js
Created September 3, 2018 15:28 — forked from jherax/filterArray.js
Filters an array of objects with multiple criteria.
/**
* Filters an array of objects with multiple criteria.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria as the property names
* @return {Array}
*/
function multiFilter(array, filters) {
const filterKeys = Object.keys(filters);
// filters all elements passing the criteria