Tests if an arbitrary value is a Success case of a Validation instance.
Tests if an arbitrary value is a Success case of a Validation instance.
const Validation = require('folktale/validation');
Validation.Success.hasInstance({ value: 1 });
// ==> false
Validation.Success.hasInstance(Validation.Success(1));
// ==> true
Validation.Success.hasInstance(Validation.Failure(1));
// ==> false
hasInstance(value) {
return Boolean(value)
&& adt.hasInstance(value)
&& value[TAG] === name;
}