Vizel API / core/src / shallowEqualArray
Function: shallowEqualArray()
ts
function shallowEqualArray<T>(a, b): boolean;Defined in: packages/core/src/utils/equality.ts:33
Return true when two arrays carry identical references in the same order and the same length.
The comparison runs in O(n) on the shared length; selectors that return short arrays (typical in toolbar / bubble-menu state slices) stay cheap to compare.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
a | readonly T[] |
b | readonly T[] |
Returns
boolean
Example
ts
shallowEqualArray([a, b], [a, b]); // true
shallowEqualArray([a, b], [a, c]); // false