tachybase_todo/packages/actions/src/utils.ts

11 lines
243 B
TypeScript
Raw Normal View History

import _ from 'lodash';
export function filterByFields(data: any, fields: any = {}): any {
const {
only = Array.isArray(fields) ? fields : null,
except = []
} = fields;
return _.omit(only ? _.pick(data, only): data, except);
}