2022-05-17 18:57:32 +08:00

21 lines
438 B
TypeScript

/**
* 类型检查
*/
export function typeCheck(param: any) {
return Object.prototype.toString.call(param);
}
/**
* 批量修改stage
*/
export function mutateState(state: AnyObject, payload: AnyObject) {
if (typeCheck(state) === '[object Object]' && typeCheck(payload) === '[object Object]') {
for (const key in payload) {
state[key] = payload[key];
}
} else {
console.error('expected plain Object');
}
}