Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
latest
bearz-io/js-resultA result type for Typescript which acts as enhanced monad/tuple for returning a results and errors without the need to throw an error.
This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers




JSR Score
100%
Published
4 months ago (0.0.0)
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;
License
Built and signed on
GitHub Actions
Add Package
deno add jsr:@bearz/result
Import symbol
import * as result from "@bearz/result";
Import directly with a jsr specifier
import * as result from "jsr:@bearz/result";
Add Package
pnpm i jsr:@bearz/result
pnpm dlx jsr add @bearz/result
Import symbol
import * as result from "@bearz/result";
Add Package
yarn add jsr:@bearz/result
yarn dlx jsr add @bearz/result
Import symbol
import * as result from "@bearz/result";
Add Package
vlt install jsr:@bearz/result
Import symbol
import * as result from "@bearz/result";
Add Package
npx jsr add @bearz/result
Import symbol
import * as result from "@bearz/result";
Add Package
bunx jsr add @bearz/result
Import symbol
import * as result from "@bearz/result";