@bearz/result
v0.0.0
Published
A simple result type for Typescript
Downloads
4
Readme
@bearz/result
Overview
The '@bearz/result' module provides the Result<T,E> type with functions ok, fail,
tryCatch, and tryCatchSync which are all used to help deal with returning results
or errors.

Documentation
Documentation is available on jsr.io
A list of other modules can be found at github.com/bearz-io/js
Usage
import { ok, fail, tryCatchSync } from "@bearz/functional";
const r = ok(10);
console.log(r.isOk);
console.log(r.isError);
console.log(r.map((v) => v.toString()));
const r1 = tryCatchSync<number>(() => {
throw Error("test");
});
console.log(r1.isError); // true
const r2 = fail<number>(new Error("test"));
console.log(r2.isError); // true;
