Skip to main content
Module

x/ahh/mod.ts>R.and

Idiomatic type-safety structures for TypeScript.
Go to Latest
method R.and
import { R } from "https://deno.land/x/ahh@v0.10.0/mod.ts";

Return other if res is Ok, or res.

Examples

import { R } from "./mod.ts";

console.log(R.and(1, 2)); // 2
console.log(R.and(Error(), 2)); // Error()
console.log(R.and(2, Error())); // Error()
console.log(R.and(Error("a"), Error("b"))); // Error("a")

Type Parameters

T
U
E extends Error

Parameters

res: Result<T, E>
other: Result<U, E>