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

Function coalesceByDay

website/script/benchmarks.js:322–329  ·  view source on GitHub ↗

* Coalesce entries by calendar day, keeping the last run of each day. * Entries must be sorted oldest-first.

(entries)

Source from the content-addressed store, hash-verified

320 * Entries must be sorted oldest-first.
321 */
322function coalesceByDay(entries) {
323 const byDay = new Map();
324 for (const entry of entries) {
325 const day = entry.timestamp.slice(0, 10); // YYYY-MM-DD
326 byDay.set(day, entry); // later entries overwrite earlier ones
327 }
328 return Array.from(byDay.values());
329}
330
331/**
332 * Thin an array to at most maxPoints by picking evenly spaced entries.

Callers 2

sampleEntriesFunction · 0.85
sampleEntriesWindowFunction · 0.85

Calls 2

setMethod · 0.80
fromMethod · 0.45

Tested by

no test coverage detected