hasInstance

Tests if an arbitrary value is a Just case of a Maybe instance.

Signature

hasInstance(value)
(Variant) => Boolean

Documentation

Tests if an arbitrary value is a Just case of a Maybe instance.

Example:

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

Maybe.Just.hasInstance({ value: 1 });
// ==> false

Maybe.Just.hasInstance(Maybe.Just(1));
// ==> true

Maybe.Just.hasInstance(Maybe.Nothing());
// ==> false

Properties

Source Code

Defined in source/adt/union/union.js at line 95, column 25
hasInstance(value) {
        return Boolean(value) 
        &&     adt.hasInstance(value) 
        &&     value[TAG] === name;
      }
Stability
stable
Licence
MIT
Authors
Copyright
(c) 2013-2017 Quildreen Motta, and CONTRIBUTORS
Authors
  • Quildreen Motta
Maintainers
  • Quildreen Motta <queen@robotlolita.me> (http://robotlolita.me/)