import { unwrap } from "https://deno.land/x/result_js@2.0.0/operators/extract.ts";
Returns the contained Ok
value.
Examples
Example 1
Example 1
import { Ok } from "https://deno.land/x/result_js/spec.ts";
import { unwrap } from "https://deno.land/x/result_js/operators/extract.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
assertEquals(unwrap(Ok(0)), 0);
Example 2
Example 2
import { Err } from "https://deno.land/x/result_js/spec.ts";
import { unwrap } from "https://deno.land/x/result_js/operators/extract.ts";
import { assertThrows } from "https://deno.land/std/testing/asserts.ts";
assertThrows(() => unwrap(Err(1)));