diff --git a/package.json b/package.json index e8f6b15..d67cbde 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "typescript" ], "author": "Vien Dinh", - "version": "2.0.13", + "version": "2.0.14", "license": "MIT", "main": "dist/index.js", "typings": "dist/index.d.ts", diff --git a/src/supermemo.test.ts b/src/supermemo.test.ts index 564cb69..4aad8f9 100644 --- a/src/supermemo.test.ts +++ b/src/supermemo.test.ts @@ -28,13 +28,21 @@ describe('supermemo', () => { it('Grade: 2', () => { item = supermemo(item, 2); - expect(item).toEqual({ interval: 1, repetition: 0, efactor: 2.1399999999999997 }); + expect(item).toEqual({ + interval: 1, + repetition: 0, + efactor: 2.1399999999999997, + }); }); it('Grade: 1', () => { item = supermemo(item, 1); - expect(item).toEqual({ interval: 1, repetition: 0, efactor: 1.5999999999999996 }); + expect(item).toEqual({ + interval: 1, + repetition: 0, + efactor: 1.5999999999999996, + }); }); it('Grade: 0', () => { diff --git a/src/supermemo.ts b/src/supermemo.ts index 7743c1d..1e88d23 100644 --- a/src/supermemo.ts +++ b/src/supermemo.ts @@ -6,7 +6,10 @@ export type SuperMemoItem = { export type SuperMemoGrade = 0 | 1 | 2 | 3 | 4 | 5; -export function supermemo(item: SuperMemoItem, grade: SuperMemoGrade): SuperMemoItem { +export function supermemo( + item: SuperMemoItem, + grade: SuperMemoGrade +): SuperMemoItem { let nextInterval: number; let nextRepetition: number; let nextEfactor: number; @@ -27,7 +30,8 @@ export function supermemo(item: SuperMemoItem, grade: SuperMemoGrade): SuperMemo nextRepetition = 0; } - nextEfactor = item.efactor + (0.1 - (5 - grade) * (0.08 + (5 - grade) * 0.02)); + nextEfactor = + item.efactor + (0.1 - (5 - grade) * (0.08 + (5 - grade) * 0.02)); if (nextEfactor < 1.3) nextEfactor = 1.3;