Q:

filter an array of objects based on matching key/value property?

This is the issue Im trying to solve. I know how to do direct comparison with objects, but Im caught how to make an either or property comparison inside a filter fx.
// tasks are objs with {name: string,id: int}

const taskArray = [task1, task2, task3, task3];

// f(x) needs to take obj param and see if it matches either/or with 
// any task obj k/v pair
// my implementation so far, missing something important, help here

const filterTasks = (taskArray, obj) => {
  taskArray.filter( task => Object.keys(task)  // i know I have to do some equality opperator here but stuck

  return taskArray;
}

A:

There it is.
filterTasks will return an array that contains only tasks in the passed array that match at least 1 key/val pair in the passed object.

tArr = [{name: "hi",id: 1},{name: "hola",id: 2},{name: "hello",id: 3},{name: "bye",id: 4}];

const filterTasks = (taskArray, obj) => taskArray.filter( task => Object.keys(task).some( key => obj[key] && obj[key]==task[key]));

console.log(filterTasks(tArr,{name:"hi",id:2}));

