{"id":21045145,"url":"https://github.com/fullpipe/ts-dice-math","last_synced_at":"2026-04-13T18:32:59.789Z","repository":{"id":57380659,"uuid":"413143761","full_name":"fullpipe/ts-dice-math","owner":"fullpipe","description":"D\u0026D math for dice rolling.","archived":false,"fork":false,"pushed_at":"2021-11-14T14:08:29.000Z","size":105,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-28T06:16:52.234Z","etag":null,"topics":["dice","dice-roller","dnd","dnd-tools","dnd5e","dnd5e-tools"],"latest_commit_sha":null,"homepage":"https://dice-math.fullpipe.dev","language":"TypeScript","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/fullpipe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-03T17:09:42.000Z","updated_at":"2021-11-14T14:34:02.000Z","dependencies_parsed_at":"2022-09-19T17:31:46.521Z","dependency_job_id":null,"html_url":"https://github.com/fullpipe/ts-dice-math","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"fullpipe/ts-package-boilerplate","purl":"pkg:github/fullpipe/ts-dice-math","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fullpipe%2Fts-dice-math","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fullpipe%2Fts-dice-math/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fullpipe%2Fts-dice-math/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fullpipe%2Fts-dice-math/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fullpipe","download_url":"https://codeload.github.com/fullpipe/ts-dice-math/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fullpipe%2Fts-dice-math/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31766473,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T15:25:13.801Z","status":"ssl_error","status_checked_at":"2026-04-13T15:25:09.162Z","response_time":93,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","dice-roller","dnd","dnd-tools","dnd5e","dnd5e-tools"],"created_at":"2024-11-19T14:20:11.216Z","updated_at":"2026-04-13T18:32:59.773Z","avatar_url":"https://github.com/fullpipe.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ts-dice-math\n\nD\u0026D math for dice rolling. See demo [https://dice-math.fullpipe.dev/](https://dice-math.fullpipe.dev/)\n\n## Install\n\n```bash\nnpm install ts-dice-math --save\n```\n\n### Browser (tested with Angular)\n\nYou have to install `crypto-browserify`\n\n```bash\nnpm intall --save crypto-browserify stream-browserify assert stream-http https-browserify os-browserify\n```\n\nand then add following to your `tsconfig.json`\n\n```jsonp\n{\n  ...\n  \"compilerOptions\": {\n    ...\n    \"paths\": {\n      \"crypto\": [\"./node_modules/crypto-browserify\"],\n      \"stream\": [\"./node_modules/stream-browserify\"],\n      \"assert\": [\"./node_modules/assert\"],\n      \"http\": [\"./node_modules/stream-http\"],\n      \"https\": [\"./node_modules/https-browserify\"],\n      \"os\": [\"./node_modules/os-browserify\"]\n    }\n  }\n}\n```\n\n## Usage\n\n```typescript\nimport { roll } from 'ts-dice-math';\n\n...\n// roll d20 with advantage\nconsole.log(roll('adv(d20, d20)'));\n\n// roll d20 with disadvantage\nconsole.log(roll('dis(d20, d20)'));\n\n// roll your two-handed sword damage\nconsole.log(roll('2d6 + 3'));\n\n// roll useless things\nconsole.log(roll('d100 / 3 + adv(d20, d20) * 2 - dis(d100, d100, d6)'));\n```\n\n## What's included\n\n| name | description |\n| ---- | ----------- |\n| `+`, `-`, `*`, `/` | simple math |\n| `d20`, `3d6`, `d12 + d8` | dice rolls |\n| `adv(d20, d20)`, `adv(d20 + 3, d20 + 3)` | Advantage. Roll two `d20` and choose best |\n| `dis(d20, d20) + 3`, `dis(d20 + 3, d20 + 3)` | Disadvantage. Roll two `d20` and choose worst |\n\n## Todo\n\n- [ ] add more useful functions\n- [ ] add validation\n- [ ] add useful error messages with position of an error\n\nFeel free to contribute.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffullpipe%2Fts-dice-math","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffullpipe%2Fts-dice-math","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffullpipe%2Fts-dice-math/lists"}