# use-streak

> a streak counter to track your streak in days (similar to Duolingo)

Latest version **1.0.4** (published 2021-11-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install use-streak
pnpm add use-streak
yarn add use-streak
bun add use-streak
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2021-11-15 |
| First published | 2021-11-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 42.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 40 |
| Author | Joe Previte |
| Maintainers | jsjoeio |
| Keywords | typescript, browser, streak, duolingo |

## Links

- npm: https://www.npmjs.com/package/use-streak
- Repository: https://github.com/jsjoeio/use-streak
- Issues: https://github.com/jsjoeio/use-streak/issues
- npm.io page: https://npm.io/package/use-streak

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2021-11-15
- 1.0.3 — 2021-11-13
- 1.0.2 — 2021-11-13
- 1.0.1 — 2021-11-13
- 1.0.0 — 2021-11-13

## README

# Streak Counter

This is a basic streak counter - inspired by Duolingo - written in TypeScript and meant for the browser (uses `localStorage`).

## Usage

```typescript
import { useStreak } from "use-streak";

const today = new Date();
const streak = useStreak(localStorage, today);
// streak returns an object:
// {
//    currentCount: 1,
//    lastLoginDate: "11/11/2021",
//    startDate: "11/11/2021",
// }
```

<img src="./streak-demo.png" alt="screenshot of streak demo" width="200" />

[![Edit vigorous-wood-o8m7w](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/vigorous-wood-o8m7w?fontsize=14&hidenavigation=1&theme=dark)

## LICENSE

MIT. Just make sure you give acknowledgements to this repo.

---
_Source: https://npm.io/package/use-streak · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
