mirror of
https://github.com/cloudflare/vinext.git
synced 2026-09-14 19:04:59 +08:00
dba7d5cd50
* feat(benchmarks): reduce repeated chart markers * fix(benchmarks): group markers by displayed value
13 lines
404 B
TypeScript
13 lines
404 B
TypeScript
export function visibleMarkerMask(
|
|
values: readonly (number | null)[],
|
|
formatValue: (value: number) => string = String,
|
|
): boolean[] {
|
|
const displayedValues = values.map((value) => (value === null ? null : formatValue(value)));
|
|
|
|
return displayedValues.map(
|
|
(value, index) =>
|
|
value !== null &&
|
|
(displayedValues[index - 1] !== value || displayedValues[index + 1] !== value),
|
|
);
|
|
}
|