Transforms a Result into a Validation.
This API is still experimental, so it may change or be removed in future versions. You should not rely on it for production applications.
Transforms a Result into a Validation.
Result's Ok
s are mapped into Validation's Success
es, and Result's Error
s
are mapped into Validation's Failure
s.
const Result = require('folktale/result');
const Validation = require('folktale/validation');
Result.Ok(1).toValidation();
// ==> Validation.Success(1)
Result.Error(1).toValidation();
// ==> Validation.Failure(1)
toValidation() {
return require('folktale/conversions/result-to-validation')(this);
}