This function receives a list of objects and a target object.
It will try to find an object in the list that matches the properties of the target object.
If a match is found, it returns the matching object and its index in the list,
otherwise it returns undefined and -1.
Since
v0.0.1
Returns
If the target object is found, the function returns a tuple with the matching object and its index in the list.
If the target object is not found, the function returns a tuple with undefined and -1.
Example
// find an object in the list constexampleListA = [{ ID:1, label:'label1' }, { ID:2, label:'label2' }] console.log( findTargetObject(exampleListA, { ID:1 }) ) => [{ ID:1, label:'label1' }, 0]
This function receives a list of objects and a target object. It will try to find an object in the list that matches the properties of the target object. If a match is found, it returns the matching object and its index in the list, otherwise it returns undefined and -1.
Since
v0.0.1
Returns
If the target object is found, the function returns a tuple with the matching object and its index in the list. If the target object is not found, the function returns a tuple with undefined and -1.
Example
Example