Skip to content

Instantly share code, notes, and snippets.

View janncors's full-sized avatar

Jann Cortés janncors

  • Colombia
View GitHub Profile
@janncors
janncors / filterArray.js
Created November 5, 2020 00:54 — forked from jherax/filterArray.js
Filters an array of objects with multiple match-criteria.
/**
* Filters an array of objects using custom predicates.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria
* @return {Array}
*/
function filterArray(array, filters) {
const filterKeys = Object.keys(filters);
return array.filter(item => {