I am using Object.entries in order to get some values out of a nested object and filter it.
Object.entries
obj = Object.entries(obj) .filter(([k, v]) => {
If you know exactly which entries you want to exclude, you can use object deconstruction combined with spreading:
function clean(obj) { const { unwanted1, unwanted2, ...wanted } = obj; return { ...wanted }; }
For some cases, this might be the cleanest solution.