Security News
Research
Supply Chain Attack on Rspack npm Packages Injects Cryptojacking Malware
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
@jprochazk/roll-dice
Advanced tools
Evaluate standard dice roll notation.
$ npm i roll-dice@npm:jprochazk/roll-dice
import { roll } from "roll-dice";
roll("5d6") // roll a 6-sided die 5 times.
roll("5d6 + 10") // roll a 6-sided die 5 times, and add 10 to the result.
description | example | |
---|---|---|
a + b | add a and b | 1 + 1 |
a - b | subtract b from a | 1 - 1 |
a * b | multiply a by b | 1 * 1 |
a / b | divide a by b | 1 / 1 |
- b | negates b | -1 |
d a | rolls an a -sided die | d5 |
a d b | rolls a b -sided die, a times | 2d10 |
( a ) | grouping expression, used to specify precedence | (1+1) |
Every a
or b
in the above table may contain another expression, and expressions may be arbitrarily nested. For example (10+5)*2+(5d10)
is a valid expression.
lib.rs
- entry point for the WASM moduleparse.rs
- a recursive descent parser which outputs a list of instructions in postfix notation.eval.rs
The library is written in Rust, and uses wasm-pack for packing it as a WASM module and publishing it on NPM. Various commands (available in the justfile) are run using just
.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
FAQs
evaluate standard dice roll notation
The npm package @jprochazk/roll-dice receives a total of 11 weekly downloads. As such, @jprochazk/roll-dice popularity was classified as not popular.
We found that @jprochazk/roll-dice demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.
Security News
Sonar’s acquisition of Tidelift highlights a growing industry shift toward sustainable open source funding, addressing maintainer burnout and critical software dependencies.