{"id":16736229,"url":"https://github.com/edloidas/roll-parser","last_synced_at":"2026-04-20T02:17:06.334Z","repository":{"id":65491211,"uuid":"84917020","full_name":"edloidas/roll-parser","owner":"edloidas","description":":dragon: Parser for classic (2d6+1), simple (2 6 1), and WoD (4d10!\u003e6f1) dice rolls.","archived":false,"fork":false,"pushed_at":"2020-10-11T11:55:39.000Z","size":320,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-14T10:16:05.376Z","etag":null,"topics":["dice","dnd","parser","regexp","roll","wod"],"latest_commit_sha":null,"homepage":"http://edloidas.com/roll-parser/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edloidas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-14T07:08:16.000Z","updated_at":"2020-11-02T00:06:39.000Z","dependencies_parsed_at":"2023-01-25T18:45:33.550Z","dependency_job_id":null,"html_url":"https://github.com/edloidas/roll-parser","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edloidas%2Froll-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edloidas%2Froll-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edloidas%2Froll-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edloidas%2Froll-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edloidas","download_url":"https://codeload.github.com/edloidas/roll-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248217126,"owners_count":21066633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dice","dnd","parser","regexp","roll","wod"],"created_at":"2024-10-13T00:08:45.124Z","updated_at":"2026-04-20T02:17:06.323Z","avatar_url":"https://github.com/edloidas.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eRoll Parser\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\nHigh-performance dice notation parser for tabletop RPGs.\u003cbr\u003e\nTypeScript-first, Bun-optimized, Pratt parser architecture.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.typescriptlang.org/\"\u003e\u003cimg src=\"https://img.shields.io/badge/TypeScript-6-blue.svg\" alt=\"TypeScript\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://bun.sh/\"\u003e\u003cimg src=\"https://img.shields.io/badge/Bun-1.3+-black.svg\" alt=\"Bun\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://nodejs.org/\"\u003e\u003cimg src=\"https://img.shields.io/badge/Node.js-22%2B-339933.svg\" alt=\"Node.js\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Status\n\n\u003e **v3 Alpha** — Stage 1 (Core Engine) is complete with 300+ tests.\n\u003e Stages 2–3 are planned.\n\u003e\n\u003e For production use, install [v2.3.2](https://www.npmjs.com/package/roll-parser/v/2.3.2).\n\n## Features\n\n### Stage 1: Core Engine (Complete)\n\n- Basic dice notation: `2d6`, `d20`, `4d6+4`\n- Full arithmetic: `+`, `-`, `*`, `/`, `%`, `**`\n- Parentheses: `(1d4+1)*2`\n- Keep/Drop modifiers: `4d6kh3`, `2d20kl1`, `4d6dl1`\n- Computed dice: `(1+1)d(3*2)`\n- Seedable RNG for reproducible rolls\n\n### Stage 2: System Compatibility (Planned)\n\n- Exploding dice: `1d6!`, `1d6!!`, `1d6!p`\n- Reroll mechanics: `2d6r\u003c2`, `2d6ro\u003c3`\n- Success counting: `10d10\u003e=6`, `10d10\u003e=6f1`\n- Math functions: `floor()`, `ceil()`, `max()`, `min()`\n\n### Stage 3: Advanced Features (Planned)\n\n- Variables: `1d20+@str`, `1d20+@{modifier}`\n- Grouped rolls: `{1d8, 1d10}kh1`\n- Rich JSON output with roll breakdown\n\n## Installation\n\n```bash\nbun add roll-parser\nnpm install roll-parser\n```\n\n## Usage\n\n```typescript\nimport { roll } from 'roll-parser';\n\nconst result = roll('4d6kh3');\nconsole.log(result.total);    // e.g., 14\nconsole.log(result.notation); // \"4d6kh3\"\n```\n\n### CLI\n\n```bash\nroll-parser 2d6+3\nroll-parser 4d6kh3\nroll-parser --help\n```\n\n## Known Limitations\n\n- **`4d6d1` parses as nested dice, not \"drop 1\".** The bare `d` token is always\n  interpreted as the dice operator, so `4d6d1` becomes `(4d6)d1` (roll 4d6, then\n  use the result as the count for d1). To drop dice, use the explicit `dl`\n  (drop lowest) or `dh` (drop highest) modifiers: `4d6dl1`.\n\n## License\n\n[MIT](LICENSE) © [Mikita Taukachou](https://edloidas.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedloidas%2Froll-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedloidas%2Froll-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedloidas%2Froll-parser/lists"}