MCPcopy Create free account
hub / github.com/JacobLinCool/LeetCode-Stats-Card / getCNProblemStats

Function getCNProblemStats

packages/core/src/query.ts:27–39  ·  view source on GitHub ↗
(
    difficulty: string,
    progress: Record<string, ProblemCount[]>,
)

Source from the content-addressed store, hash-verified

25}
26
27function getCNProblemStats(
28 difficulty: string,
29 progress: Record<string, ProblemCount[]>,
30): DifficultyStats {
31 return {
32 solved: progress.ac.find((x) => x.difficulty === difficulty.toUpperCase())?.count || 0,
33 total: (Object.values(progress) as ProblemCount[][]).reduce(
34 (acc, arr) =>
35 acc + (arr.find((x) => x.difficulty === difficulty.toUpperCase())?.count || 0),
36 0,
37 ),
38 };
39}
40
41export class Query {
42 async us(username: string, headers?: Record<string, string>): Promise<FetchedData> {

Callers 1

cnMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected