Skip to main content

Function: sameCursor()

sameCursor(a, b): boolean

Defined in: packages/sdvplot/src/selection.ts:135

Whether two cursors are the same: the same field and an ===-equal value, so 0 and -0 are one hover value (NaN never gets into the store). null equals only null.

Parameters​

a​

Cursor | null

b​

Cursor | null

Returns​

boolean

Example​

import { sameCursor } from "@sportsdataverse/sdvplot";

const rim = { field: "shot_distance", value: 0.5 }; // the centre of the 0-1 ft bin
[
sameCursor(rim, { field: "shot_distance", value: 0.5 }), // a new object, the same value: true
sameCursor(rim, { field: "shot_distance", value: 1.5 }), // the next bin: false
sameCursor(rim, null), // the pointer left: false
sameCursor(null, null),
];