0.1.1 • Published 3 years ago
@kylerriggs/streak-counter v0.1.1
@kylerriggs/streak-counter - a basic streak counter
This is a basic streak counter - inspired by Duolingo - written in TypeScript and meant for the browser (uses localStorage)
Install
yarn:
yarn add @kylerriggs/streak-counternpm:
npm install @kylerriggs/streak-counterUsage
import { streakCounter } from '@kylerriggs/streak-counter'
const today = new Date()
const streak = streakCounter(localStorage, today)
// streak returns an object:
// {
//      currentCount: 1,
//      lastLoginDate: "10/10/2022",
//      startDate: "10/10/2022",
// }