sp-repetition

2.0.0 • Public • Published

Spaced repetition algorithm

Schedule next due date for flashcards by answering and calculating progress.

import Record from '@porto/spaced-repetition';

const DAY_IN_MS = 24 * 60 * 60 * 1000;
const today = Math.round(new Date('2000-01-01').getTime() / DAY_IN_MS); // => 10957

const card = new Record(0, today, [1, 4, 8, 17], [-3, -1, 1]);

/* GOOD */
card.review(1); // => { dueDate: 10958, progress: 1 }

/* GOOD */
card.review(1); // => { dueDate: 10962, progress: 2 }

/* AGAIN */
card.review(-3); // => { dueDate: 10958, progress: 0 }

Readme

Keywords

none

Package Sidebar

Install

npm i sp-repetition

Weekly Downloads

1

Version

2.0.0

License

ISC

Unpacked Size

2.25 kB

Total Files

3

Last publish

Collaborators

  • portothree