Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

never-catch

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

never-catch

A design pattern to implement result in functions.

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-44.44%
Maintainers
1
Weekly downloads
 
Created
Source

never-catch

  • No boilerplate
  • Type support
  • Auto type infer
const divideTenBy = (a: number) => {
    if (a === 0) {
        return err('divide by zero');
    } else {
        return ok(10 / a);
    }
};

const result = divideTenBy(5);
if (result.ok) {
    console.log(result.value);// OK
} else {
    console.log(result.error);// Ok
    console.log(result.value);// TS2339: Property 'value' does not exist on type 'Err '.
}

Email: mnafisiasl@gmail.com

Keywords

FAQs

Package last updated on 27 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc