cloneobject
Filename pattern: *.js
const cloneObj = (obj) => {
const props = Object.getOwnPropertyNames(obj);
for (const name of props) {
const value = obj[name];
if (value && typeof value === 'object') {
cloneObj(value);
}
}
return Object.assign({}, obj);
};