Hope you've had your coffee. I'm trying to figure out why this works:
state.map((good) => {
if ( good.type === type ) {
return _.assign(good, { amount })
}
else {
return good
}
})
but this doesn't:
_.map(state, _.cond([
[
_.matchesProperty("type", type),
_.partialRight(_.assign, { amount })
],
[_.stubTrue, _.identity]
]))
Assuming the following:
const state = [{ type: "thing", amount: 0 }]
const type = "thing"
const amount = 1
The output of both should be:
[{ type: "thing", amount: 1 }]
however the output to the second option is:
[{ type: "thing", amount: 0 }]
Full failing test: