MCPcopy Create free account
hub / github.com/Noumena-Network/code / bucket

Function bucket

src/components/Stats.tsx:397–400  ·  view source on GitHub ↗
(min: number, max?: number)

Source from the content-addressed store, hash-verified

395 if (total > 0) {
396 const totalShots = Object.entries(dist).reduce((s_0, [count, sessions]) => s_0 + parseInt(count, 10) * sessions, 0);
397 const bucket = (min: number, max?: number) => Object.entries(dist).filter(([k]) => {
398 const n_0 = parseInt(k, 10);
399 return n_0 >= min && (max === undefined || n_0 <= max);
400 }).reduce((s_1, [, v]) => s_1 + v, 0);
401 const pct = (n_1: number) => Math.round(n_1 / total * 100);
402 const b1 = bucket(1, 1);
403 const b2_5 = bucket(2, 5);

Callers 2

OverviewTabFunction · 0.85
renderOverviewToAnsiFunction · 0.85

Calls 1

entriesMethod · 0.80

Tested by

no test coverage detected