Package Exports
- spacerepetition
- spacerepetition/dist/spacerepetition.min.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (spacerepetition) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Space Repetition
A Spaced Repetition Library
Install + Import
$ npm install spacerepetitionAnd import it
import { createFlashcards } from 'spacerepetition'Or you can include it from a CDN:
<script src="https://cdn.jsdelivr.net/npm/spacerepetition/dist/spacerepetition.min.js"></script>And use it:
<script>
const flashcards = Spacerepetition.createFlashcards(5)
</script>Usage
It doesn't matter what your data looks like, it will always return an array of flashcards:
const flashcards = createFlashcards([1, "two"])
/* returns:
{
"1": {
"value": 1,
"next": 1,
"prev": 1
},
"two": {
"value": "two",
"next": "two",
"prev": "two"
}
}
*/
const flashcards = createFlashcards([{ front: "question", back: "answer" }, { front: "question", back: "answer" }])Just avoid using the following keys which will conflict with the ones used by the library:
Spaced Repetition Algorithms
const flashcards = createFlashcards([])
const flashcards = createFlashcards([], "sm2")
const flashcards = createFlashcards([], "sm2")You can also specify your own algorithm as long as it adhers to XXXXXXXX:
function myAlgorithm() {
return "myAlgorithm"
}
const flashcards = createFlashcards([], myAlgorithm)Config
You can also pass a config object as the third parameter:
const flashcards = createFlashcards([], "default", {
"initial": 5,
"interval": 10,
"factor": 2.5
})Statistics
You can get statistics about the flashcards:
// todo