Equaler Namespace
Package: @esfx/equatable
Provides various implementations of Equaler
.
Functions
combineHashes(x, y, rotate)
Combines two hash codes.
Declaration
function combineHashes(x: number, y: number, rotate?: number): number;
Parameters
- rotate
- number
The number of bits (between 0 and 31) to left-rotate the first hash code before XOR'ing it with the second (default 7).
Returns
create(equalityComparison, hashGenerator)
Creates an Equaler
from a comparison function and an optional hash generator.
Declaration
function create<T>(equalityComparison: EqualityComparison<T>, hashGenerator?: HashGenerator<T>): Equaler<T>;
Type Parameters
- T
The type of value that can be compared.
Parameters
Returns
Equaler<T>
An Equaler for the provided callbacks.
hasInstance(value)
Declaration
function hasInstance(value: unknown): value is Equaler<unknown>;
Parameters
- value
- unknown
Returns
value is Equaler<unknown>
Variables
defaultEqualer
Gets the default Equaler
.
Declaration
defaultEqualer: Equaler<unknown>
structuralEqualer
Gets a default Equaler
that supports StructuralEquatable
values.
Declaration
structuralEqualer: Equaler<unknown>
tupleEqualer
An Equaler
that compares array values rather than the arrays themselves.
Declaration
tupleEqualer: Equaler<readonly unknown[]>
tupleStructuralEqualer
An Equaler
that compares array values that may be StructuralEquatable
rather than the arrays themselves.
Declaration
tupleStructuralEqualer: Equaler<readonly unknown[]>