toValidation

Transforms a Result into a Validation.

Signature

toValidation()
forall a, b: (Result a b).() => Validation a b

Documentation

Transforms a Result into a Validation.

Result's Oks are mapped into Validation's Successes, and Result's Errors are mapped into Validation's Failures.

Example:

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

Result.Ok(1).toValidation();
// ==> Validation.Success(1)

Result.Error(1).toValidation();
// ==> Validation.Failure(1)

Properties

Source Code

Defined in source/result/result.js at line 327, column 22
toValidation() {
    return require('folktale/conversions/result-to-validation')(this);
  }
Stability
stable
Licence
MIT
Module
folktale/result/result
Authors
Copyright
(c) 2013-2017 Quildreen Motta, and CONTRIBUTORS
Authors
  • Quildreen Motta
Maintainers
  • Quildreen Motta <queen@robotlolita.me> (http://robotlolita.me/)