Skip to main content
Module

x/result_js/mod.ts>isOk

Minimum result type port of Rust
Latest
function isOk
import { isOk } from "https://deno.land/x/result_js@2.0.0/mod.ts";

Returns true if the result is a Ok.

Examples

Example 1

import { isOk } from "https://deno.land/x/result_js/operators/query.ts";
import { Ok, type Result } from "https://deno.land/x/result_js/spec.ts";
import { assert } from "https://deno.land/std/testing/asserts.ts";

const result: Result<unknown, unknown> = Ok(1);
assert(isOk(result));

Parameters

result: Result<T, unknown>

Returns

result is Ok<T>