import { match } from "https://deno.land/x/result_js@2.0.0/operators/extract.ts";
Pattern matching for result
. Match on matcher.Ok
if Ok
, otherwise match on matcher.Err
.
Examples
Example 1
Example 1
import { Ok, type Result } from "https://deno.land/x/result_js/spec.ts";
import { match } from "https://deno.land/x/result_js/operators/extract.ts";
declare const result: Result<number, unknown>;
match(result, {
Ok: (value) => value,
Err: (value) => 500,
});