lib-streak-math
v1.0.0
Published
Dependency-free calendar-day bucketing and streak math primitives, with an optional Node-only on-disk store. Helper for svelte-streak-lib.
Maintainers
Readme
lib-streak-math
Dependency-free calendar-day and streak-math primitives. This is the helper
package behind svelte-streak-lib; it is not meant to
be imported directly from application code.
API
import { dayKey, addDays, dayDiff, bucketByDay, qualifyingDayKeys } from 'lib-streak-math';
import { store } from 'lib-streak-math/store'; // Node-onlydayKey(date, timeZone?)→"YYYY-MM-DD"addDays(key, n)→ shifted day keydayDiff(aKey, bKey)→ whole-day differencebucketByDay(entries, timeZone?)→Map<dayKey, total>qualifyingDayKeys(entries, goal, timeZone?)→ sorted day keys meeting the goal
