JSPM

option-t

0.1.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 81014
  • Score
    100M100P100Q186105F

Option type implementation whose APIs are inspired by Rust's `Option<T>`.

Package Exports

  • option-t

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (option-t) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

OptionType

npm version Build Status

  • This library represents Option type in ECMAScript.
  • APIs are inspired by Rust Language's Option<T>.

Installation

npm install --save option-t

Usage

var OptionType = require('option-t').OptionType;

// `Some<T>`
var some = new OptionType(1);
console.log(some.isSome); // true
console.log(some.value); // 1

// `None`
var none = new OptionType();
console.log(some.isSome); // false
console.log(some.value); // undefined

JSON Representation

new OptionType(1) will be

{
    "is_some": true,
    "value": 1
}

License

MIT License