Skip to content

drazenbuljovcic/errors-as-values

Repository files navigation

errors-as-values

Purpose

This library exposes helpers to streamline the control flow in your applications. As errors are thrown in Javascript natively, this library is built with the intention of getting as close to Go style syntax of always treating the error as a first class citizen and returning it together with the output of the given function.

// eav -> errors as values
const [error, value] = eav(myFunctionThatDoesSomething);

if (null != error) {
  // handle error here
}
// use value being safe

Contribution

To install dependencies:

bun install

To build the library run:

bun run build

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

Deployment

  • Build with bun run build
  • Go into dist
  • Run npm version <patch|minor|major>
  • Run npm publish

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published