1.0.0 • Published 4 years ago

@functional-things/maybe v1.0.0

Weekly downloads
5
License
Unlicense
Repository
github
Last release
4 years ago

@functional-things/maybe

Maybe type for TypeScript.

This package provides a (embarassingly trivial) Maybe type for TypeScript.

Install

$ npm install --save @functional-things/maybe

Usage

import { Maybe } from "@functional-things/maybe";

const operationThatCanFail = (...args: any[]): Maybe<ResultType> =>
{
    // ...
};

const result = operationThatCanFail(/* ... */);

if (result !== null)
    console.error("Operation failed!");