I have an array of objects and I would like to test it to determine whether a property with a certain value exists (at least one occurrence) and for it to return a boolean value to indicate the result. I'm using the Ramda library and have been experimenting with the has
function to try and achieve this, however this only returns a boolean on whether the actual property exists and not it's respective value.
const data = [
{
id: 10004,
name: 'Daniel',
age: 43,
sport: 'football'
},
{
id: 10005,
name: 'Tom',
age: 23,
sport: 'rugby'
},
{
id: 10006,
name: 'Lewis',
age: 32,
sport: 'football'
},
];
Checking the array of objects for sport: 'rugby'
should return true
and sport: 'tennis'
should return false.
Any help will be greatly appreciated, thanks.