import { or } from "https://deno.land/x/result_js@2.0.0/operators/logical.ts";
Returns res
if the result
is Err
, otherwise returns the Ok
.
Examples
Example 1
Example 1
import { or } from "https://deno.land/x/result_js/operators/logical.ts";
import { Err, Ok, type Result } from "https://deno.land/x/result_js/spec.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
declare const result: Result<unknown, unknown>;
assertEquals(or(Ok(0), result), Ok(0));
assertEquals(or(Err(1), result), result);