toValidation

A convenience method for the folktale/conversions/maybe-to-validation module.

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

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

Documentation

A convenience method for the folktale/conversions/maybe-to-validation module.

Example:

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

Maybe.Just(1).toValidation(0);
// ==> Validation.Success(1)

Maybe.Nothing().toValidation(0)
// ==> Validation.Failure(0)

Properties

Source Code

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