Skip to main content

@oxi/result@0.2.0

A TypeScript implementation of the Rust-inspired Result type, offering a robust and functional approach to error handling and success management in asynchronous and synchronous operations.

Works with
This package works with Bun
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Browsers
JSR Score
100%
Published
a month ago
indexErr
variable Err
deno add @oxi/result
import { Err } from "@oxi/result";
npx jsr add @oxi/result
import { Err } from "@oxi/result";
yarn dlx jsr add @oxi/result
import { Err } from "@oxi/result";
pnpm dlx jsr add @oxi/result
import { Err } from "@oxi/result";
bunx jsr add @oxi/result
import { Err } from "@oxi/result";

A convenience reference to the Result.Err method, allowing for the creation of Err result instances without directly invoking the Result class. This function facilitates the creation of Err results, encapsulating error values in a more succinct and readable manner.

Examples

Example 1

const error = Err("Something went wrong");
console.log(error.toString()); // "Err(Something went wrong)"