package-trendsv0.2.1 analyse()
  1. package-trends
  2. Data
  3. analyse()

analyse()

The figures you would need to write about a package without looking at the chart.

direction
flat (weak, r² 0.00)
weekly growth
2.93%
annualised
348.7%
mean
32,478,748
median
35,538,242
busiest day
Thursday
quietest day
Sunday
weekend ratio
0.61
volatility
2.6%
spikes
0
streak
1 rising week

The code for what is on screen

import { analyse, fetchDownloads } from "package-trends";

const a = analyse(await fetchDownloads("react", { period: "last-month" }));

a.direction;    // "rising" | "falling" | "flat"
a.confidence;   // "strong" | "moderate" | "weak", from the r²
a.weekendRatio; // weekday-driven use sits near 0.6

The field to build a sentence on is confidence. A slope alone will cheerfully report that react is falling by 390,000 a day; the r² behind it is what says the month was flat and the slope is noise.