toResult

Transforms a Validation into a Reseult.

Signature

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

Documentation

Transforms a Validation into a Reseult.

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

Example:

const { Success, Failure } = requiure('folktale/validation');
const Result = require('folktale/result');

Success('a').toResult();
// ==> Result.Ok('a')

Failure('a').toResult();
// ==> Result.Error('a')

Properties

Source Code

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