This package has been deprecated

Author message:

Not in maintainence

optionify
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

optionify

An 1KB (gzipped) utility which returns an Option type. No dependencies. Works both in browser and Node.js.

Travis Codecov License NPM Version NPM Downloads

Installation

Using Yarn:

$ yarn add optionify

Using npm:

$ npm install optionify

Usage

import { optionify } from 'optionify'
 
const fn = optionify(() => {
  // a function may return `undefined` or `null`
})
 
const option = fn()
 
console.log(option.isSome())
console.log(option.isNone())
console.log(option.unwrap())

For more usage please check Rust std documentation.

License

MIT License

Copyright (c) 2018-present Pig Fang

Dependents (0)

Package Sidebar

Install

npm i optionify

Weekly Downloads

0

Version

1.2.0

License

MIT

Unpacked Size

6.92 kB

Total Files

8

Last publish

Collaborators

  • gplane