I'm trying to remove lodash from one of my projects, so I'm going through and substituting the lodash methods I've used with either native JS ones or just ones I have written myself. Although, I am currently stuck on lodash transform. I'm using it on an object and I'm struggling to work out how to replace it. I could achieve something similar with reduce, but reduce only works on arrays..
For example,
let obj = {
'field1': 1,
'field2': 2,
'field3': 3
}
let transformed = _.transform(obj, (result, value, key) => {
if (typeof value !== 'object') {
result[key] = value * 2;
}
}
Is there a method I'm overlooking... Any help would be appreciated.