Module

x/rambda/rambda.js>tryCatch

Faster and smaller alternative to Ramda
Latest
function tryCatch
import { tryCatch } from "https://dotland.deno.dev/x/rambda@9.4.1/rambda.js";

It returns function that runs fn in try/catch block. If there was an error, then fallback is used to return the result. Note that fn can be value or asynchronous/synchronous function(unlike Ramda where fallback can only be a synchronous function).

Parameters

fn: (input: T) => U
fallback: U

Returns

(input: T) => U

Parameters

fn: (input: T) => U
fallback: (input: T) => U

Returns

(input: T) => U

Parameters

fn: (input: any) => Promise<any>
fallback: T

Returns

(input: any) => Promise<T>

Parameters

fn: (input: any) => Promise<any>
fallback: (input: any) => Promise<any>

Returns

(input: any) => Promise<T>