Answer the question
In order to leave comments, you need to log in
Is it possible to get rid of the direct access to the object?
There is a code:
const obj = {
someProperty1: {
data: 12
},
someProperty2: {
data: 44
}
}
R.assocPath(
["someProperty1", "data"],
R.path(
["someProperty2", "data"],
obj
)
)(obj)
Answer the question
In order to leave comments, you need to log in
Can. But why? The code above is easier to understand.
And if for academic purposes, then, for example, like this:
R.compose(
R.apply(R.assocPath(["someProperty1", "data"])),
R.juxt([
R.path(["someProperty2", "data"]),
R.identity,
])
)(obj)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question