import { mapErr } from "https://deno.land/x/result_js@2.0.0/operators/transform.ts";
Examples
Example 1
Example 1
import { Err, type Result } from "https://deno.land/x/result_js/spec.ts";
import { mapErr } from "https://deno.land/x/result_js/operators/transform.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
const result: Result<unknown, string> = Err("Hello, World!");
const resultLen = mapErr(result, (v) => v.length);
assertEquals(resultLen, Err(13));