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
indexOk
variable Ok
deno add @oxi/result
import { Ok } from "@oxi/result";
npx jsr add @oxi/result
import { Ok } from "@oxi/result";
yarn dlx jsr add @oxi/result
import { Ok } from "@oxi/result";
pnpm dlx jsr add @oxi/result
import { Ok } from "@oxi/result";
bunx jsr add @oxi/result
import { Ok } from "@oxi/result";

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

Examples

Example 1

const success = Ok(123);
console.log(success.toString()); // "Ok(123)"