Utilities for immutably updating, comparing, and hashing arrays.
Type declaration
empty: (<T>() => readonly T[])
<T>(): readonly T[]
Type Parameters
T
Returns readonly T[]
compare:function
compare(x, y): number
Returns the relative order of x with respect to y. Returns -1 if
the elements of array x order lexicographically before the elements of
array y; returns 1 if the elements of array x order lexicographically
after the elements of array y; and returns 0 if x and y are equal
arrays. If either x or y is null or undefined, then arrays order
before null, and null orders before undefined.
Parameters
x: ArrayLike<unknown>
y: ArrayLike<unknown>
Returns number
equal:function
equal(x, y): boolean
Returns true if x and y are structurally equal arrays; otherwise
returns x === y if either x or y is not an array.
Parameters
x: ArrayLike<unknown>
y: ArrayLike<unknown>
Returns boolean
equivalent:function
equivalent(x, y, epsilon?): boolean
Returns true if x and y are structurally [[Equivalent.equivalentTo
equivalent]] arrays; otherwise returns x === y if either x or y is
not an array.
Parameters
x: ArrayLike<unknown>
y: ArrayLike<unknown>
Optionalepsilon: number
Returns boolean
hash:function
hash(x): number
Returns a 32-bit hash value for the elements of array x, if defined;
otherwise returns 0 or 1 if x is undefined or null, respectively.
Returns a copy of an array with the given element inserted, if the element
is not already present in the array; otherwise returns the input array if
it already contains the specified element.
Utilities for immutably updating, comparing, and hashing arrays.