isEquatable()
Syntax
function isEquatable(object: unknown): object is Equatable
Type guard that checks whether a value is an Equatable
.
Parameters | |
object
|
An object whose type isn’t known. |
Example
import { isEquatable } from 'potence';
const object = {
value: 2,
equals: function(other) { return this.value === other.value; }
};
const object2 = {
value: 2
};
if (isEquatable(object)) {
object.equals(object2); // -> true
}
Remarks
See Equatable
.