MCPcopy Index your code
hub / github.com/npmx-dev/npmx.dev / fillPartialBucket

Function fillPartialBucket

app/utils/chart-data-buckets.ts:11–14  ·  view source on GitHub ↗
(value: number, actualDays: number, totalDays: number)

Source from the content-addressed store, hash-verified

9
10/** Proportionally scale a partial bucket to estimate the full-period value. */
11export function fillPartialBucket(value: number, actualDays: number, totalDays: number): number {
12 if (actualDays <= 0 || actualDays >= totalDays) return value
13 return Math.round((value * totalDays) / actualDays)
14}
15
16function sortedDaily(daily: DailyRawPoint[]): DailyRawPoint[] {
17 return daily.slice().sort((a, b) => a.day.localeCompare(b.day))

Callers 4

buildWeeklyEvolutionFunction · 0.85
buildMonthlyEvolutionFunction · 0.85
buildYearlyEvolutionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected