@sazed/streak-counter
v1.1.0
Published
This is a basic streak counter - inspired by Duolingo, and made following Joe Previte's course - written in TypeScript and meant for the browser (uses `localStorage`).
Downloads
3
Readme
@sazed/streak-counter
- a basic streak counter
This is a basic streak counter - inspired by Duolingo,
and made following Joe Previte's course -
written in TypeScript and meant for the browser (uses localStorage
).
Install
yarn add @sazed/streak-counter
Usage
import { streakCounter } from '@sazed/streak-counter';
const today = new Date();
const streak = streakCounter(localStorage, today);
streak returns an object:
{
currentCount: 1,
lastLoginDate: "01/24/2023",
startDate: "01/24/2023",
}