import { omitBy, isNil, pick, omit } from 'lodash'; export type Dict = Record; export function omitUndefined(obj: any) { return omitBy(obj, isNil); } export function extractInObject(parent: any, values: Array) { return [ omitUndefined(pick(parent, values)), omitUndefined(omit(parent, values)), ]; }