{"_id":"@2bad/dice","_rev":"3-268c5df4e8da4766e8f201d62b64855b","name":"@2bad/dice","dist-tags":{"latest":"0.0.3"},"versions":{"0.0.2":{"name":"@2bad/dice","version":"0.0.2","keywords":["dice","roll","dnd","rng"],"author":{"url":"https://github.com/2BAD","name":"2BAD"},"license":"MIT","_id":"@2bad/dice@0.0.2","maintainers":[{"name":"mrhyde","email":"npm@2bad.me"},{"name":"armordarks","email":"npm@lavrins.com"}],"contributors":[{"url":"https://github.com/mrhyde","name":"Jason Hyde","email":"github@2bad.me"}],"homepage":"https://github.com/2BAD/dice#readme","bugs":{"url":"https://github.com/2BAD/dice/issues"},"dist":{"shasum":"32eb055199288fc66c23f28bc9c5f7888c258494","tarball":"https://registry.npmjs.org/@2bad/dice/-/dice-0.0.2.tgz","fileCount":9,"integrity":"sha512-jw5ZmBbkmX1a9B8YTZtS+h/z5P2CvJBpcaWKUhSW3g6e5pu5eEKG0XQKWEURYyLX8RZRCQ8RerpLvpeotmciJQ==","signatures":[{"sig":"MEUCIHqDOFPF042WPyfTbwH5zYArXnO9T47wNmI/Ym60/3YeAiEAljvIQWdqnTYpMjRsUXuiLbPBFwFadcvxtIZj7bOgYH0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@2bad%2fdice@0.0.2","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":7292},"type":"module","volta":{"node":"19.9.0"},"engines":{"node":">=18"},"exports":"./build/index.js","gitHead":"268c9b35c0f45ed7b3c9da084c7c6e6bf15ce47f","scripts":{"lint":"eslint . --ext .ts","test":"vitest run","build":"run-s compile fix-alias","clean":"rimraf build","compile":"tsc --project tsconfig.build.json","lint:fix":"run-s \"lint -- --fix\"","fix-alias":"tsc-alias -p tsconfig.build.json","test:unit":"vitest run unit --coverage","format:fix":"prettier --write source/**/*.ts","preversion":"run-s clean lint test build","format:check":"prettier --check source/**/*.ts","prepublishOnly":"run-s clean build","test:integration":"vitest run integration --coverage"},"typings":"./build/index.d.ts","_npmUser":{"name":"mrhyde","email":"npm@2bad.me"},"prettier":{"semi":false,"printWidth":120,"singleQuote":true,"trailingComma":"none"},"repository":{"url":"git+https://github.com/2BAD/dice.git","type":"git"},"_npmVersion":"9.6.3","description":"Utility library to compute dice rolls","directories":{},"_nodeVersion":"19.9.0","dependencies":{"pure-rand":"6.0.2"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"8.40.0","rimraf":"5.0.0","vitest":"0.31.0","prettier":"2.8.8","tsc-alias":"1.8.6","typescript":"5.0.4","@types/node":"20.1.0","npm-run-all":"4.1.5","@2bad/tsconfig":"1.5.1","eslint-plugin-n":"15.7.0","@vitest/coverage-c8":"0.31.0","eslint-plugin-import":"2.27.5","eslint-plugin-promise":"6.1.1","eslint-config-prettier":"8.8.0","eslint-plugin-prettier":"4.2.1","@typescript-eslint/parser":"5.59.5","@typescript-eslint/eslint-plugin":"5.59.5","eslint-import-resolver-typescript":"3.5.5","eslint-config-standard-with-typescript":"34.0.1"},"_npmOperationalInternal":{"tmp":"tmp/dice_0.0.2_1684194446062_0.6338005374733635","host":"s3://npm-registry-packages"}},"0.0.3":{"name":"@2bad/dice","version":"0.0.3","keywords":["dice","roll","dnd","rng"],"author":{"url":"https://github.com/2BAD","name":"2BAD"},"license":"MIT","_id":"@2bad/dice@0.0.3","maintainers":[{"name":"mrhyde","email":"npm@2bad.me"},{"name":"armordarks","email":"npm@lavrins.com"}],"contributors":[{"url":"https://github.com/mrhyde","name":"Jason Hyde","email":"github@2bad.me"}],"homepage":"https://github.com/2BAD/dice#readme","bugs":{"url":"https://github.com/2BAD/dice/issues"},"dist":{"shasum":"94cd0a51d8cd374b29dd0de65ca2db0c617604c3","tarball":"https://registry.npmjs.org/@2bad/dice/-/dice-0.0.3.tgz","fileCount":9,"integrity":"sha512-1QekuKnibEruGX1gV/bg5KIBtIubtfunlc1N187omIHB+fu7pqo4rz28Mg+QWSRqbOUj8uhJ1CVlev0ggOauEw==","signatures":[{"sig":"MEYCIQDk3q5CoV3diTtdgC1kF6opj63y0mxshKKXgMkPGDeF/AIhALFBhKRR2/NFyacfmh8nkxVDA11FvDFfYHfGhGttDHZK","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@2bad%2fdice@0.0.3","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":8922},"type":"module","volta":{"node":"19.9.0"},"engines":{"node":">=18"},"exports":"./build/index.js","gitHead":"81fdc1ade535a255f26dacdb1386c58e27fb3e02","scripts":{"lint":"eslint . --ext .ts","test":"vitest run","build":"run-s compile fix-alias","clean":"rimraf build","compile":"tsc --project tsconfig.build.json","lint:fix":"run-s \"lint -- --fix\"","fix-alias":"tsc-alias -p tsconfig.build.json","test:unit":"vitest run unit --coverage","format:fix":"prettier --write source/**/*.ts","preversion":"run-s clean lint test build","format:check":"prettier --check source/**/*.ts","prepublishOnly":"run-s clean build","test:integration":"vitest run integration --coverage"},"typings":"./build/index.d.ts","_npmUser":{"name":"mrhyde","email":"npm@2bad.me"},"prettier":{"semi":false,"printWidth":120,"singleQuote":true,"trailingComma":"none"},"repository":{"url":"git+https://github.com/2BAD/dice.git","type":"git"},"_npmVersion":"9.6.3","description":"Utility library to compute dice rolls","directories":{},"_nodeVersion":"19.9.0","dependencies":{"pure-rand":"6.0.2"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"8.40.0","rimraf":"5.0.0","vitest":"0.31.0","prettier":"2.8.8","tsc-alias":"1.8.6","typescript":"5.0.4","@types/node":"20.1.0","npm-run-all":"4.1.5","@2bad/tsconfig":"1.5.1","eslint-plugin-n":"15.7.0","@vitest/coverage-c8":"0.31.0","eslint-plugin-import":"2.27.5","eslint-plugin-promise":"6.1.1","eslint-config-prettier":"8.8.0","eslint-plugin-prettier":"4.2.1","@typescript-eslint/parser":"5.59.6","@typescript-eslint/eslint-plugin":"5.59.6","eslint-import-resolver-typescript":"3.5.5","eslint-config-standard-with-typescript":"34.0.1"},"_npmOperationalInternal":{"tmp":"tmp/dice_0.0.3_1684205927238_0.4421722387664093","host":"s3://npm-registry-packages"}}},"time":{"created":"2023-05-15T23:47:25.963Z","modified":"2024-07-18T17:26:50.443Z","0.0.2":"2023-05-15T23:47:26.268Z","0.0.3":"2023-05-16T02:58:47.419Z"},"bugs":{"url":"https://github.com/2BAD/dice/issues"},"author":{"url":"https://github.com/2BAD","name":"2BAD"},"license":"MIT","homepage":"https://github.com/2BAD/dice#readme","keywords":["dice","roll","dnd","rng"],"repository":{"url":"git+https://github.com/2BAD/dice.git","type":"git"},"description":"Utility library to compute dice rolls","contributors":[{"url":"https://github.com/mrhyde","name":"Jason Hyde","email":"github@2bad.me"}],"maintainers":[{"email":"npm@2bad.me","name":"mrhyde"},{"email":"npm@lavrins.com","name":"armordarks"}],"readme":"# Dice\n\n[![NPM version](https://img.shields.io/npm/v/@2bad/dice)](https://www.npmjs.com/package/@2bad/dice)\n[![License](https://img.shields.io/npm/l/@2bad/dice)](https://www.npmjs.com/package/@2bad/dice)\n[![GitHub Build Status](https://img.shields.io/github/actions/workflow/status/2BAD/dice/build.yml)](https://github.com/2BAD/dice/actions/workflows/build.yml)\n[![Code coverage](https://img.shields.io/codecov/c/github/2BAD/dice)](https://codecov.io/gh/2BAD/dice)\n[![Written in TypeScript](https://img.shields.io/github/languages/top/2BAD/dice)](https://github.com/2BAD/dice/search?l=typescript)\n\nTypeScript library that allows you to simulate rolling different types and quantities of dice. You can easily perform calculations and generate random numbers for use in games, simulations, and more.\n\n## Install\n\n```shell\nnpm install @2bad/dice\n```\n\n**Warning:** This package is native [ESM](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) and no longer provides a CommonJS export. If your project uses CommonJS, you will have to [convert to ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) or use the [dynamic `import()`](https://v8.dev/features/dynamic-import) function. Please don't open issues for questions regarding CommonJS / ESM.\n\n## Usage\n\n```typescript\nimport { roll } from '@2bad/dice'\n\n// Roll a six-sided die with lowercase 'd'\nroll('d6')\n// same as\nroll('D6')\n\n// Roll two eight-sided dice\nroll('2d8')\n\n// Roll two twenty-sided dice\nroll('2d20').\n```\n\n## Dice-Rolling with Modifier\n\nIn addition to rolling a single die or multiple dice, this dice-rolling program can also handle modifiers. A modifier is a number added to or subtracted from the total value obtained from the dice rolls. For instance, in DnD, instead of just rolling a 20-sided die (d20), you might also add a modifier to reflect a character's skill or level.\n\nTo roll a dice with a modifier, simply include a plus (+) or minus (-) sign and another integer at the end of your dice-roll string. Here are some examples:\n\n- 2d6+3: Roll two six-sided dice and add 3 to the total value.\n- d20-1: Roll a single 20-sided die and subtract 1 from the total value.\n- 3d8+12: Roll three eight-sided dice and add 12 to the total value.\n\nNote that the modifier applies to the entire result of the dice roll, not each individual die roll. When using a modifier, it's important to check the rules of your game system to determine which calculations are appropriate.\n\n## Backus–Naur form grammar for dice roll string syntax\n\n```\n<dice-notation>   ::= <non-zero-number>? \"d\" <non-zero-number> <modifier>?\n<modifier>        ::= (\"+\" | \"-\") <non-zero-number>\n<non-zero-number> ::= <non-zero-digit> | <number>\n<number>          ::= <non-zero-digit> <digit>*\n<digit>           ::= \"0\" | <non-zero-digit>\n<non-zero-digit>  ::= \"1\" | \"2\" | \"3\" | \"4\" | \"5\" | \"6\" | \"7\" | \"8\" | \"9\"\n```\n\nThis BNF grammar defines the syntax for a dice notation, which consists of a optional non-zero number of dice to be rolled and a number of sides each die has, optionally followed by a modifier that can be added to or subtracted from the result of the roll.\n\n## Contributing\n\nWe welcome contributions! If you find a bug or want to request a new feature, please open an issue. If you want to submit a bug fix or new feature, please open a pull request.\n","readmeFilename":"README.md"}