import { O } from "https://deno.land/x/ahh@v0.10.0/mod.ts";
Calls f
with opt
, and returns it if the result is
true
.
Examples
import { O, None } from "./mod.ts";
console.log(O.filter(2, (i) => i % 2 === 0)); // 2
console.log(O.filter(1, (i) => i % 2 === 0)); // None
console.log(O.filter(None, (i: number) => i % 2 === 0)); // None