ant-design/components/_util/splitObject.tsx
2016-07-13 11:14:24 +08:00

13 lines
268 B
TypeScript

export default function splitObject(obj, parts): Array<any> {
let left = {};
let right = {};
Object.keys(obj).forEach((k) => {
if (parts.indexOf(k) !== -1) {
left[k] = obj[k];
} else {
right[k] = obj[k];
}
});
return [left, right];
}