deleteNillValueFromObject

删除undefined,null,[],{}Object

1
2
3
4
5
6
7
8
const deleteNillValueFromObject = obj => {
// {a:1, b: 2, c: null, d: []}
const noEmpty = (val, key) => {
return !(R.isNil(val) || R.isEmpty(val));
};
const removeEmptyFromObject = R.curry(R.pickBy(noEmpty));
return removeEmptyFromObject(obj);
};