import { mapOr } from "https://deno.land/x/result_js@2.0.0/mod.ts";
Examples
Example 1
Example 1
import { Ok, type Result } from "https://deno.land/x/result_js/spec.ts";
import { mapOr } from "https://deno.land/x/result_js/operators/transform.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
const result: Result<string, number> = Ok("Hello");
assertEquals(mapOr(result, 0, ({ length }) => length), 5);