import { filter } from "https://deno.land/x/fun@v2.0.0/set.ts";
Given a Refinement or Predicate over A and a ReadonlySet return a new ReadonlySet with only values for which the predicate or refinement return true.
Examples
Example 1
Example 1
import * as S from "./set.ts";
import { pipe } from "./fn.ts";
const set = S.set(1, 2, 3, 4, 5);
const result1 = pipe(set, S.filter(n => n > 2)); // Set(3, 4, 5)
const result2 = pipe(set, S.filter(n => n === 0)); // Set()
Type Parameters
B extends A
Parameters
refinement: Refinement<A, B>