kube/monolite

Permit function as value replacement parameter.

Closed this issue · 0 comments

kube commented

Accept a function as new value in set, that will permit to use it like this:

set(tree, _ => _.child.target)(oldValue => newValue)

It would permit to push in an Immutable List for example:

set(tree, _ => _.child.immutableList)(list => list.push(item))

Or with a transformation function:

const square = x => x * x

set(tree, _ => _.child.numberValue)(square)