ant-design/components/_util/splitObject.tsx
2016-10-20 14:48:13 +08:00

13 lines
272 B
TypeScript

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