const v1 = { a: '1', b: 20, c: null, d: undefined, } const v1 = { a: '1', b: 20, } const params = Object.keys(data) .filter((key) => data[key] !== null && data[key] !== undefined) .reduce((acc, key) => ({ ...acc, [key]: data[key] }), {});
https://www.jianshu.com/p/4d76644b0e42