shineout
Version:
Shein 前端组件库
35 lines (32 loc) • 629 B
text/typescript
import immer from 'immer'
const names: string[] = [
'delay',
'onDatumBind',
'rules',
'formDatum',
'forceChange',
'trim',
'beforeChange',
'validateHook',
'innerFormNamePath',
'fieldSetValidate',
'combineRules',
'popoverProps',
'inputFocus',
'placeTitle',
'cancelChange',
'integerLimit',
'autoSelect',
'autoFix',
'numType',
]
/**
* delete some props if needed, will not modify the pass argument
* @param props
* @returns {Produced<*, *>}
*/
export default function cleanProps(props: { [x: string]: any }) {
return immer(props, draft => {
names.forEach(p => delete draft[p])
})
}