Skip to content

Commit 95ed21f

Browse files
committed
2.0.14
1 parent 769009a commit 95ed21f

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"typescript"
1212
],
1313
"author": "Vien Dinh",
14-
"version": "2.0.13",
14+
"version": "2.0.14",
1515
"license": "MIT",
1616
"main": "dist/index.js",
1717
"typings": "dist/index.d.ts",

src/supermemo.test.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,21 @@ describe('supermemo', () => {
2828
it('Grade: 2', () => {
2929
item = supermemo(item, 2);
3030

31-
expect(item).toEqual({ interval: 1, repetition: 0, efactor: 2.1399999999999997 });
31+
expect(item).toEqual({
32+
interval: 1,
33+
repetition: 0,
34+
efactor: 2.1399999999999997,
35+
});
3236
});
3337

3438
it('Grade: 1', () => {
3539
item = supermemo(item, 1);
3640

37-
expect(item).toEqual({ interval: 1, repetition: 0, efactor: 1.5999999999999996 });
41+
expect(item).toEqual({
42+
interval: 1,
43+
repetition: 0,
44+
efactor: 1.5999999999999996,
45+
});
3846
});
3947

4048
it('Grade: 0', () => {

src/supermemo.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ export type SuperMemoItem = {
66

77
export type SuperMemoGrade = 0 | 1 | 2 | 3 | 4 | 5;
88

9-
export function supermemo(item: SuperMemoItem, grade: SuperMemoGrade): SuperMemoItem {
9+
export function supermemo(
10+
item: SuperMemoItem,
11+
grade: SuperMemoGrade
12+
): SuperMemoItem {
1013
let nextInterval: number;
1114
let nextRepetition: number;
1215
let nextEfactor: number;
@@ -27,7 +30,8 @@ export function supermemo(item: SuperMemoItem, grade: SuperMemoGrade): SuperMemo
2730
nextRepetition = 0;
2831
}
2932

30-
nextEfactor = item.efactor + (0.1 - (5 - grade) * (0.08 + (5 - grade) * 0.02));
33+
nextEfactor =
34+
item.efactor + (0.1 - (5 - grade) * (0.08 + (5 - grade) * 0.02));
3135

3236
if (nextEfactor < 1.3) nextEfactor = 1.3;
3337

0 commit comments

Comments
 (0)