Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/optio/operators/extract.ts>unwrap

Minimum option type port of Rust
Latest
function unwrap
import { unwrap } from "https://deno.land/x/optio@1.0.0/operators/extract.ts";

Returns the contained Some value.

Examples

Example 1

import { Some } from "https://deno.land/x/optio/spec.ts";
import { unwrap } from "https://deno.land/x/optio/operators/extract.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";

assertEquals(unwrap(Some(0)), 0);

Example 2

import { None } from "https://deno.land/x/optio/spec.ts";
import { unwrap } from "https://deno.land/x/optio/operators/extract.ts";
import { assertThrows } from "https://deno.land/std/testing/asserts.ts";

assertThrows(() => unwrap(None));