hasInstance

Tests if an arbitrary value is a Failure case of a Validation instance.

This feature is experimental!

This API is still experimental, so it may change or be removed in future versions. You should not rely on it for production applications.

Signature

hasInstance(value)
(Variant) => Boolean

Documentation

Tests if an arbitrary value is a Failure case of a Validation instance.

Example:

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

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

Validation.Failure.hasInstance(Validation.Success(1));
// ==> false

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

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
experimental
Licence
MIT
Authors
Copyright
(c) 2013-2017 Quildreen Motta, and CONTRIBUTORS
Authors
  • Quildreen Motta
Maintainers
  • Quildreen Motta <queen@robotlolita.me> (http://robotlolita.me/)