oofdere / crabrave

better typescript enums (also Option<T>, Result<T, E>)

Home Page:https://crabrave.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

crabrave

near-zero-cost abstractions ported from Rust to TypeScript

features:

  • very simple API that closely follows Rust's
  • rust style enums with packed data
  • Option<T> and Result<T> types
  • match(), matchPartial(), and unwrap()
  • about as performant as doing the comparisons by hand
  • very lightweight, you won't notice it's even there in prod
  • works in all environments (browser, node, bun, deno)
  • (soon) helpers to wrap existing functions
  • (soon) wrappers over built-in web APIs and external libraries (a very simple and incomplete fetch wrapper is already included)

Check /test for code examples.

To install development dependencies:

bun install

To run:

bun run index.ts

To test:

bun test

This project was created using bun init in bun v1.0.7. Bun is a fast all-in-one JavaScript runtime.

About

better typescript enums (also Option<T>, Result<T, E>)

https://crabrave.vercel.app


Languages

Language:TypeScript 98.8%Language:Shell 1.2%