Returns true if the array contains an item where item[key] === value.
true
item[key] === value
The array to search.
The key to match on.
The value to match.
hasArrayItemByKey([{ id: 1 }, { id: 2 }], "id", 2) // => truehasArrayItemByKey([{ id: 1 }, { id: 2 }], "id", 99) // => false Copy
hasArrayItemByKey([{ id: 1 }, { id: 2 }], "id", 2) // => truehasArrayItemByKey([{ id: 1 }, { id: 2 }], "id", 99) // => false
Returns
trueif the array contains an item whereitem[key] === value.