fromMaybe

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

Signature

fromMaybe(aMaybe, fallbackValue)
forall a, b: (Maybe b, a) => Validation a b

Documentation

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

Example:

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

Validation.fromMaybe(Maybe.Just(1), 'error');
// ==> Validation.Success(1)

Validation.fromMaybe(Maybe.Nothing(), 'error');
// ==> Validation.Failure('error')

Properties

Source Code

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