1.2.0 • Published 7 years ago

optionify v1.2.0

Weekly downloads
8
License
MIT
Repository
github
Last release
7 years ago

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

1.2.0

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.0

7 years ago