Nothing Particularly Magnificent
Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

optionify

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

Keywords

none

install

npm i optionify

Downloadsweekly downloads

1

version

1.2.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability