Currently I am using something like:
const foo = bar.map((baz) => {
return {
...baz,
qux: baz.qux.map((quux) => {
return {
...quux,
aNewProperty: 'yay!'
}
}
}
});
To make the point clear, it would be ideal to have something similar to the set method in lodash:
const foo = bar;
set(foo, 'bar.baz.qux.quux', { bar.baz.qux.quux, aNewPorperty: 'yay!' });
Note: I am not aware of how lodash and underscore are related but the current project I'm working on is using underscore. And at this time it's not possible to convert to lodash just for this single use-case.
Currently I am using something like:
To make the point clear, it would be ideal to have something similar to the set method in lodash:
Note: I am not aware of how lodash and underscore are related but the current project I'm working on is using underscore. And at this time it's not possible to convert to lodash just for this single use-case.