hasInstance

Tests if an arbitrary value is a Result 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)
Union.(Variant) -> Boolean

Documentation

Tests if an arbitrary value is a Result instance.

Example:

const Result = require('folktale/result');

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

Result.hasInstance(Result.Ok(1));
// ==> true

Result.hasInstance(Result.Error(1));
// ==> true

Properties

Source Code

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