| 1234567891011121314 |
- /**
- * 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<T>(set: Array<T>, compareBy: keyof T) {
- return (item: T) => set.some(t => t[compareBy] === item[compareBy]);
- }
|