import { refinement } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { and } = refinement;
Compose two refinements into a new refinement that returns true if both of the two input refinements return true.
Examples
Example 1
Example 1
import type { Newtype } from "./newtype.ts";
import * as R from "./refinement.ts";
import { pipe } from "./fn.ts";
const isBig = (s: unknown): s is "Big" => s === "Big";
const refine = pipe(R.string, R.and(isBig));
const result1 = refine(null); // false
const result2 = refine("Hello"); // false
const result3 = refine("Big"); // false
Type Parameters
C extends A
Parameters
second: Refinement<A, C>
Returns
<B extends A>(first: Refinement<A, B>) => Refinement<A, B & C>