Gaps in npm's data
npm answers 0 for a day it has not aggregated, and gives you no way to tell that from a day nobody installed the package. Taken literally those zeros are not a small error.
- mean/day
- 32,478,748
- direction
- flat
- quietest
- Sunday
- weekend ratio
- 0.61
- days npm missed
- 7 of 30
The code for what is on screen
<PackageTrend package="react" gaps="fill" />
// the days npm had no data for
const { gapDays } = computeTrend(await fetchDownloads("react"));Switch the policy above and watch every figure move. On a sample of react seven
of thirty days came back zero: the mean fell by a quarter, the weekday profile inverted, and a flat
month read as a falling one. Interior zeros are interpolated from their neighbours and listed in
gapDays, so you can say so where it matters.
Questions
Why does npm report zero downloads for some days?
Those are days the registry has not aggregated, not days nobody installed the package — and the API gives you no way to tell the two apart. package-trends interpolates interior zeros from their neighbours and lists them in gapDays.