abbott-methods
Version:
abbott,methods,method,functions,function
21 lines (20 loc) • 530 B
text/typescript
/**
* 把规则对象中排除指定的字段
* @param {object} ruleObj
* @param {Array} excludeAry
* @returns {object}
*/
export const vExclude = (
ruleObj: Record<string | number | symbol, any> = {}, // 规则对象
excludeAry: any[] = [] // 要排除的字段数组
): Record<string | number | symbol, any> => {
const obj: Record<string | number | symbol, any> = {}
for (const key in ruleObj) {
if (excludeAry.includes(key)) {
continue
} else {
obj[key] = ruleObj[key]
}
}
return obj
}