pragmatic-fp-ts
Version:
Opinionated functional programming library with easy use in mind
20 lines (16 loc) • 581 B
text/typescript
import { complement, Dictionary, filter, Predicate } from "./main.ts";
export function reject<A>(pred: Predicate<A>, coll: A[]): A[];
export function reject<A>(
pred: Predicate<A>,
coll: Dictionary<A>
): Dictionary<A>;
export function reject<A>(pred: Predicate<A>): (coll: A[]) => A[];
export function reject<A>(
pred: Predicate<A>
): (coll: Dictionary<A>) => Dictionary<A>;
export function reject(pred: Predicate<any>, coll?: any) {
if (arguments.length === 1) {
return (theColl: any) => reject(pred, theColl);
}
return filter(complement(pred), coll) as any;
}