import { pipe } from "fp-ts/function" import cloneDeep from "lodash/cloneDeep" import isEqual from "lodash/isEqual" export const objRemoveKey = (key: K) => (obj: T): Omit => pipe(cloneDeep(obj), (e) => { delete e[key] return e }) export const objFieldMatches = ( fieldName: K, matches: ReadonlyArray ) => // eslint-disable-next-line no-unused-vars (obj: T): obj is T & { [_ in K]: V } => matches.findIndex((x) => isEqual(obj[fieldName], x)) !== -1