I am trying to return an array of keys from a nested array based on two conditions using Ramda:
- object has a property
delete: false - object does not have property
delete
So my array looks something like this:
const array = [{id: 1, name: "test1"}, {id: 2, name: "test2", delete: true}, {id: 3, name: "test3", delete: false}]
So the result should be [1, 3]
So far I have this statement, which partially works, it returns the ids for the objects that don't have property delete, I am not sure how to check if property had delete: false and return it in the result:
map(
pipe(
ifElse(
has("delete"),
pipe(propEq("delete", false), prop("id")),
prop("id")
)
))(array)