lc-review 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.mjs +10 -4
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# lc-review
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/lc-review)
|
|
4
4
|
|
|
5
5
|
`lc-review` is a command-line tool designed to help you manage and review your
|
|
6
6
|
LeetCode problems using the SuperMemo 2 (SM2) algorithm for spaced repetition.
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,6 @@ import { appendFile, readFile } from "node:fs/promises";
|
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { supermemo } from "supermemo";
|
|
6
|
-
import dayjs from "dayjs";
|
|
7
6
|
|
|
8
7
|
//#region src/core.ts
|
|
9
8
|
const logRecordSchema = z.object({
|
|
@@ -100910,7 +100909,7 @@ const createReviewItem = (problemNumber, initialDate) => ({
|
|
|
100910
100909
|
const practiceReviewItem = (reviewItem, grade, attemptDate) => {
|
|
100911
100910
|
const newSm2Item = supermemo(reviewItem.sm2Item, grade);
|
|
100912
100911
|
const nDays = newSm2Item.interval * INTERVAL_FACTOR;
|
|
100913
|
-
const newDueDate =
|
|
100912
|
+
const newDueDate = new Date(new Date(attemptDate).getTime() + nDays * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
|
|
100914
100913
|
const newNumAttempts = reviewItem.numAttempts + 1;
|
|
100915
100914
|
return {
|
|
100916
100915
|
problemNumber: reviewItem.problemNumber,
|
|
@@ -100946,8 +100945,8 @@ const processLogRecords = (logRecords) => {
|
|
|
100946
100945
|
reviewMap.set(problemNumber, updatedItem);
|
|
100947
100946
|
}
|
|
100948
100947
|
return [...reviewMap.values()].sort((a, b) => {
|
|
100949
|
-
const dateA =
|
|
100950
|
-
const dateB =
|
|
100948
|
+
const dateA = new Date(a.dueDate).valueOf();
|
|
100949
|
+
const dateB = new Date(b.dueDate).valueOf();
|
|
100951
100950
|
if (dateA !== dateB) return dateA - dateB;
|
|
100952
100951
|
return b.frustrationScore - a.frustrationScore;
|
|
100953
100952
|
});
|
|
@@ -100963,6 +100962,10 @@ const review = async (logFile, n, premium = false) => {
|
|
|
100963
100962
|
}
|
|
100964
100963
|
};
|
|
100965
100964
|
|
|
100965
|
+
//#endregion
|
|
100966
|
+
//#region package.json
|
|
100967
|
+
var version = "0.0.4";
|
|
100968
|
+
|
|
100966
100969
|
//#endregion
|
|
100967
100970
|
//#region src/index.ts
|
|
100968
100971
|
const INCLUDE_PREMIUM = false;
|
|
@@ -100975,6 +100978,9 @@ async function main() {
|
|
|
100975
100978
|
case "help":
|
|
100976
100979
|
printHelp();
|
|
100977
100980
|
break;
|
|
100981
|
+
case "version":
|
|
100982
|
+
console.log(`lc-review v${version}`);
|
|
100983
|
+
break;
|
|
100978
100984
|
case "next": {
|
|
100979
100985
|
const n = args.shift();
|
|
100980
100986
|
await review(SOLUTIONS_FILE, n ? parseInt(n) : 1, INCLUDE_PREMIUM);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lc-review",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "LeetCode flashcards for spaced repetition learning",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "tsdown",
|
|
21
|
+
"fmt": "npx prettier --write .",
|
|
22
|
+
"lc-review": "node ./dist/index.mjs",
|
|
21
23
|
"test": "vitest run",
|
|
22
24
|
"test:watch": "vitest --watch"
|
|
23
25
|
},
|
|
@@ -36,7 +38,6 @@
|
|
|
36
38
|
"vitest": "4.0.16"
|
|
37
39
|
},
|
|
38
40
|
"dependencies": {
|
|
39
|
-
"dayjs": "1.11.19",
|
|
40
41
|
"supermemo": "2.0.23",
|
|
41
42
|
"zod": "4.2.1"
|
|
42
43
|
},
|