Skip to content

Instantly share code, notes, and snippets.

View delatorrenelson's full-sized avatar
:octocat:
...

Mr. Nelson delatorrenelson

:octocat:
...
  • Metro Manila, Philippines
View GitHub Profile
@delatorrenelson
delatorrenelson / filterArray.js
Created April 21, 2023 15:45 — forked from jherax/arrayFilterFactory.1.ts
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 => {