Inverts the status of a Validation, such that Failures become Successes, and vice-versa.
forall a, b: (Validation a b).() => Validation b a
Inverts the status of a Validation, such that Failures become Successes, and vice-versa.
const { Success, Failure } = require('folktale/validation');
Success('a').swap();
// ==> Failure('a')
Failure('a').swap();
// ==> Success('a')
{
/*~*/
Failure: function swap() {
return Success(this.value);
},
/*~*/
Success: function swap() {
return Failure(this.value);
}
}