/** * Takes a predicate function and returns a negated version. */ export function not(predicate: (...args: any[]) => boolean) { return (...args: any[]) => !predicate(...args); } /** * Returns a predicate function which returns true if the item is found in the set, * as determined by a === equality check on the given compareBy property. */ export function foundIn(set: Array, compareBy: keyof T) { return (item: T) => set.some(t => t[compareBy] === item[compareBy]); }