Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
keep calm, keep learning.

Adimas Lutfi kraizt

:octocat:
keep calm, keep learning.
  • Yogyakarta
View GitHub Profile
@jherax
jherax / filterArray.js
Last active May 4, 2021
Filters an array of objects with multiple match-criteria.
View filterArray.js
/**
* 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 => {