MCPcopy Create free account
hub / github.com/csskit/csskit / sampleEntriesWindow

Function sampleEntriesWindow

website/script/benchmarks.js:358–367  ·  view source on GitHub ↗

* Filter entries to a timestamp window [minMs, maxMs], then resample.

(entries, minMs, maxMs)

Source from the content-addressed store, hash-verified

356 * Filter entries to a timestamp window [minMs, maxMs], then resample.
357 */
358function sampleEntriesWindow(entries, minMs, maxMs) {
359 const windowed = entries.filter((e) => {
360 const ms = new Date(e.timestamp).getTime();
361 return ms >= minMs && ms <= maxMs;
362 });
363 // Within a zoom window show all coalesced points (no further thinning)
364 // unless there are still more than MAX_POINTS
365 const coalesced = coalesceByDay(windowed);
366 return thinEvenly(coalesced, MAX_POINTS);
367}
368
369/**
370 * Attach zoom/reset handlers to a chart that update its series from fullSeriesBuilder.

Callers

nothing calls this directly

Calls 2

coalesceByDayFunction · 0.85
thinEvenlyFunction · 0.85

Tested by

no test coverage detected