hasInstance

Tests if an arbitrary value is a Validation instance.

Signature

hasInstance(value)
Union.(Variant) -> Boolean

Documentation

Tests if an arbitrary value is a Validation instance.

Example:

const Validation = require('folktale/validation');

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

Validation.hasInstance(Validation.Success(1));
// ==> true

Validation.hasInstance(Validation.Failure(1));
// ==> true

Properties

Source Code

Defined in source/adt/union/union.js at line 194, column 35
hasInstance(value) {
      return Boolean(value)
      &&     value[TYPE] === this[TYPE];
    }
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/)