Object.keys(updateValues).forEach(field => {
allowedFields.indexOf(field) === -1 && delete updateValues[field];
});
In the above code I am iterating over updateValues
and deleting indexes that no exist in allowedFields, however after enabling Eslint the delete updateValues[field];
is failing the no-param-reassign rule.
I was thinking of using a method which destructures the [field] and returns the remaining. Can anyone provide an example of this or offer and direction?