just create function like:
const replaceEmpty = (obj) => {
let newObj = {};
Object.keys(obj).forEach((key) => {
if (obj[key] === Object(obj[key])) newObj[key] = removeEmpty(obj[key]);
else if (obj[key] !== undefined) newObj[key] = obj[key];
else if (obj[key] === undefined) newObj[key] = '';
});
return newObj;
};
that's all, hope this func can help U 😵💫
Top comments (0)