ant-design/components/_util/splitObject.tsx

13 lines
268 B
TypeScript
Raw Normal View History

2016-07-13 11:14:24 +08:00
export default function splitObject(obj, parts): Array<any> {
2016-06-22 13:18:43 +08:00
let left = {};
let right = {};
2016-07-13 11:14:24 +08:00
Object.keys(obj).forEach((k) => {
2016-06-22 13:18:43 +08:00
if (parts.indexOf(k) !== -1) {
left[k] = obj[k];
} else {
2016-06-23 10:57:52 +08:00
right[k] = obj[k];
2016-06-22 13:18:43 +08:00
}
});
return [left, right];
2016-07-13 11:14:24 +08:00
}