I have two arrays:
ids = [1,3,5];
The second array is:
items: [
{id: 1, name: 'a'},
{id: 2, name: 'b'},
{id: 3, name: 'c'},
{id: 4, name: 'd'},
{id: 5, name: 'e'},
{id: 6, name: 'f'}
];
I want to create a new array with only the items whose IDs match the ones in the 'ids' array:
array = [{id: 1, name: 'a'}, {id: 3, name: 'c'}, {id: 5, name: 'e'}];
I am struggling to figure this out. I have tried:
console.log(R.filter(R.propEq('id', <don't know what should be here>), items);
console.log( R.pick(ids)(items))