Performs a deep-comparison of two Result values for equality. See adt/union/derivations/equality
for details.
This API is still experimental, so it may change or be removed in future versions. You should not rely on it for production applications.
Performs a deep-comparison of two Result values for equality. See adt/union/derivations/equality
for details.
const Result = require('folktale/result');
Result.Ok(1).equals(Result.Ok(1));
// ==> true
Result.Error(1).equals(Result.Error(1));
// ==> true
Result.Ok(1).equals(Result.Error(1));
// ==> false
Result.Ok(Result.Ok(1)).equals(Result.Ok(Result.Ok(1)));
// ==> true
function(value) {
assertType(adt)(`${this[tagSymbol]}#equals`, value);
return sameType(this, value) && compositesEqual(this, value, Object.keys(this));
}