Say I have an array of objects {key:string} where all the keys-value pairs are unique (keys or values are allowed to the same in different objects, but the same key value pair)
const arr = [{a_1:"val_1"}, {a_2:"val_2"}, ..., {a_n:"val_n"}];
and I have a target object
const target = {a_i: "val_i"};
I want to find if target exists in arr i.e if it's key and value match a certain object in arr. If true, then I want the object from arr to be returned.
example: (Edited)
const target = {foo: "bar"};
const arr = [{foo: "bar"}, {corona: "COVID-19"}, {foo: "notBar"}, {notFoo: "bar"}];
In this example, the search of target on arr will return {foo:"bar"} from arr.
Note:
arr.find(ob => ob === target);
returns undefined.