调用接口时过滤为空的数据

/** 舍弃字典中value为空的键值对 */
export const abandonDictionary = dict => {
	let keys = {};
	Object.keys(dict).forEach(o => {
		let val = dict[o];
		if (
			(getType(val) === "Array" && val.length > 0) ||
			(getType(val) !== "Array" && (val || val == 0) && val != "") ||
			getType(val) === "Boolean"
		) {
			keys[o] = val;
		}
	});
	return keys;
};
上一篇:1.9 查找两个字典的相同点


下一篇:资源-Android:Android