toMaybe

Transforms a Validation into a Maybe. Failure values are lost in the process.

Signature

toMaybe()
forall a, b: (Validation a b).() => Maybe b

Documentation

Transforms a Validation into a Maybe. Failure values are lost in the process.

Example:

const { Success, Failure } = require('folktale/validation');
const Maybe = require('folktale/maybe');

Success('a').toMaybe();
// ==> Maybe.Just('a')

Failure('a').toMaybe();
// ==> Maybe.Nothing()

Properties

Source Code

Defined in source/validation/validation.js at line 276, column 26
toMaybe() {
    return require('folktale/conversions/validation-to-maybe')(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/)