0.0.2 • Published 3 years ago

@nexvelso/streak-counter v0.0.2

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

@ashleynexvelsolutions/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 add @ashleynexvelsolutions/streak-counter
npm install @ashleynexvelsolutions/streak-counter

Usage

Edit streak-counter (egghead) (forked)

import { streakCounter } from "@ashleynexvelsolutions/streak-counter";
 
const today = new Date();
const streak = streakCounter(localStorage, today);
// streak returns an object:
// {
//    currentCount: 1,
//    lastLoginDate: "11/11/2021",
//    startDate: "11/11/2021",
// }