fromNullable

A convenience method for the folktale/conversions/nullable-to-maybe module.

Signature

fromNullable(aNullable)
forall a: (a or void) => Maybe a

Documentation

A convenience method for the folktale/conversions/nullable-to-maybe module.

Example:

const Maybe = require('folktale/maybe');

Maybe.fromNullable(1);
// ==> Maybe.Just(1)

Maybe.fromNullable(null);
// ==> Maybe.Nothing()

Maybe.fromNullable(undefined);
// ==> Maybe.Nothing()

Properties

Source Code

Defined in source/maybe/index.js at line 23, column 17
fromNullable(aNullable) {
    return require('folktale/conversions/nullable-to-maybe')(aNullable);
  }
Stability
stable
Licence
MIT
Module
folktale/maybe
Authors
Copyright
(c) 2013-2017 Quildreen Motta, and CONTRIBUTORS
Authors
  • Quildreen Motta
Maintainers
  • Quildreen Motta <queen@robotlolita.me> (http://robotlolita.me/)