@kineticcafe/result
TypeScript icon, indicating that this package has built-in type declarations

0.6.1 • Public • Published

@kineticcafe/result

Description

@kineticcafe/result is another Result type implementation for Typescript, loosely based on Rust's std::result type.

Result types contain a value or possible error and should be used to return different types for success and failure without using exceptions for normal flow control. As the values in Results are not directly accessible, there is explicit error handling at the point of use, through matching (Result#match), transformation (Result#andThen, Result#orElse), unwrapping (Result#unwrap, Result#unwrapErr), mapping (Result#map, Result#mapErr), or propagation (returning the result to callers).

The @kineticcafe/result library additionally offers some utilities for dealing with arrays of Result types.

Synopsis

import { Ok, Err } from '@kineticcafe/result'

Ok(3) // A successful result
Err('error') // A likely error

Installation

@kineticcafe/result should be added to your list of dependencies in package.json.

npm add @kineticcafe/result@^0.6

Semantic Versioning

@kineticcafe/result uses a Semantic Versioning scheme with one significant change:

  • When PATCH is zero (0), it will be omitted from version references.

Contributing

@kineticcafe/result welcomes contributions. This project, like all Kinetic Commerce open source projects, is under the Kinetic Commerce Open Source Code of Conduct.

This project is licensed under the Apache Licence, version 2.0 and requires certification via a Developer Certificate of Origin. See Licence.md for more details.

Readme

Keywords

none

Package Sidebar

Install

npm i @kineticcafe/result

Weekly Downloads

22

Version

0.6.1

License

Apache-2.0

Unpacked Size

58.3 kB

Total Files

11

Last publish

Collaborators

  • halostatue