Using Ramda.js (and lenses), I want to modify the JavaScript object below to change \"NAME:VERSION1\" to \"NAME:VERSION2\" for the object that has ID= \"/1/B/i\".
I want
Here's one solution:
const updateDockerImageName =
R.over(R.lensProp('groups'),
R.map(R.over(R.lensProp('apps'),
R.map(R.when(R.propEq('id', '/1/B/i'),
R.over(R.lensPath(['container', 'docker', 'image']),
R.replace(/^NAME:VERSION1$/, 'NAME:VERSION2')))))));
This could be decomposed into smaller functions, of course. :)