swap

Inverts the status of a Validation, such that Failures become Successes, and vice-versa.

Signature

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

Documentation

Inverts the status of a Validation, such that Failures become Successes, and vice-versa.

Example:

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

Success('a').swap();
// ==> Failure('a')

Failure('a').swap();
// ==> Success('a')

Properties

Source Code

Defined in source/validation/validation.js at line 70, column 23
{
    /*~*/
    Failure: function swap() {
      return Success(this.value);
    },

    /*~*/
    Success: function swap() {
      return Failure(this.value);
    }
  }
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/)