0.0.1 • Published 2 years ago

@attilam/streak-counter v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@attilam/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 @attilam/streak-counter

or

npm install @attilam/streak-counter

Usage

import {streakCounter} from '@attilam/streak-counter';

const today = new Date();
const streak = streakCounter(localStorage, today);

// streak returns an Object:
// {
//   currentCount: 1,
//   lastLoginDate: "06/18/2022",
//   startDate: "06/18/2022"
// }

Course Notes

via https://www.typescriptcourse.com/

yarn init -y
yarn add -D typescript jest ts-jest @types/jest
yarn tsc --init
yarn ts-jest config:init