How masaue/jan-js-lib works
Project type and purpose
• This is an open-source TypeScript library (NPM package) named “jan-js-lib” whose sole purpose is to calculate Mahjong hand scores under the Mahjong Competition Rules (and work-in-progress Zung Jung Mahjong).
• There is no frontend or backend service; it is a purely computational domain library, consumed by other applications.
File structure
• Top-level files and folders
• package.json / package-lock.json / LICENSE / .gitignore / tsconfig*.json
• README.md, README-ja.md, documents/ (supporting docs)
• src/main/ts/… (the library’s domain and calculation code)
• src/test/js/… (unit tests against the compiled JS)
• Within src/main/ts/, you see a clear domain module breakdown under “jan/”:
• Domain entities and types: janpai.ts, mentsu.ts, hand.ts, complete-info.ts, etc.
• Utility modules for pattern detection and scoring: mcr-util.ts, yaku-util.ts, zjm-util.ts.
• Enumeration and ID definitions: janpai-id.ts, mentsu-type.ts, suit.ts, wind.ts.
• Build and deployment
• tsconfig.json configures local development
• tsconfig-publish.json likely controls compiled output for NPM
• No CI/CD or Docker artifacts—publishing is via npm (per documents/HowToPublish.md).
Key insights from the README
• Exports a set of classes/types (CompleteInfo, Hand, Janpai, McrUtil, Mentsu, etc.).
• Usage example shows the flow: build a Hand, pass it plus CompleteInfo into McrUtil.complete(), then inspect the returned object (point total + yakuList).
• There is no external database or network; it’s pure in-memory computation.
Detail
• Distinction between MCR and ZJM rule modules.
• Publish path (src → dist → npm) and the test path (dist → tests).
• Keep labels succinct but precise (e.g., “McrUtil.complete() → CompleteResult”).