Skip to content

Commit 0270a11

Browse files
authored
Unfurl a great number of types and functions. (#625)
1 parent 16bad8a commit 0270a11

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+456
-2254
lines changed

.github/workflows/tsdoc.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Simple workflow for deploying static content to GitHub Pages
2+
name: TSDoc Actions
3+
4+
on:
5+
release:
6+
# Allows you to run this workflow manually from the Actions tab
7+
workflow_dispatch:
8+
9+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
15+
jobs:
16+
# Single deploy job since we're just deploying
17+
deploy:
18+
name: Deploy Documentation
19+
20+
# Deploy to the github-pages environment
21+
environment:
22+
name: github-pages
23+
url: ${{ steps.deployment.outputs.page_url }}
24+
25+
# Specify runner + deployment step
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout repo
29+
uses: actions/checkout@v3
30+
31+
- name: Use Bun
32+
uses: oven-sh/setup-bun@v1
33+
with:
34+
bun-version: latest
35+
36+
- name: Install deps
37+
run: bun install
38+
39+
- name: TSDoc Action
40+
uses: erikyo/tsdoc-action@v1
41+
with:
42+
source_dir: ./src/*
43+
output_dir: ./docs
44+
front_page: README.md
45+
46+
- name: Setup Pages
47+
uses: actions/configure-pages@v3
48+
49+
- name: Upload artifact
50+
uses: actions/upload-pages-artifact@v2
51+
with:
52+
# Upload entire repository
53+
path: './docs'
54+
55+
- name: Deploy to GitHub Pages
56+
id: deployment
57+
uses: actions/deploy-pages@v2

GETTING_STARTED.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ console.log(result.total) // a random number between 1 and 20
3636

3737
### The Roll Result
3838

39-
`roll()` returns a `RollResult` object. This has plenty of helpful keys, but the big ones are `total` and `result`.
39+
`roll()` returns a `RandsumRollResult` object. This has plenty of helpful keys, but the big ones are `total` and `result`.
4040

4141
`total` returns the combined total of all your rolls, whereas `result` is an `Array` of `Array`s, each one representing the _set_ of different roll results for each pool of dice you rolled.
4242

@@ -67,7 +67,7 @@ roll('4d20H+2') // Roll 4 20 sided die, drop highest, add 2
6767

6868
---
6969

70-
You can pass in a `DicePoolOptions` as the first argument. While rolling standard numerical die, `sides` is the only required value, representing the number of distinct sides of the die.
70+
You can pass in a `RandsumRollOptions` as the first argument. While rolling standard numerical die, `sides` is the only required value, representing the number of distinct sides of the die.
7171

7272
```ts
7373
roll({ sides: 20 }) // Roll a single 20 sided die
@@ -79,7 +79,7 @@ The other commonly used key will be `quantity`, which tells you how many dice to
7979
roll({ sides: 20, quantity: 4 }) // Roll 4 distinct 20 sided die, and give me the total.
8080
```
8181

82-
You can use the `modifier` property of `DicePoolOptions.options` to further modify your roll. `modifiers` is an object that you can fill with Modifier objects. For instance:
82+
You can use the `modifier` property of `RandsumRollOptions.options` to further modify your roll. `modifiers` is an object that you can fill with Modifier objects. For instance:
8383

8484
```ts
8585
roll({
@@ -147,9 +147,9 @@ roll([
147147

148148
### Advanced Usage
149149

150-
`RollResult` has several other keys that can come in handy for sussing out the specifics of your dice rolls.
150+
`RandsumRollResult` has several other keys that can come in handy for sussing out the specifics of your dice rolls.
151151

152-
- `dicePools` is an object representing the normalized state of each argument passed to `roll`. This includes a version of the provided dice pool argument as a `DicePoolOption` (`option`), as `DiceNotation` (`notation`), a `Die` representing a single die in this particular `dicePool` and in an array of strings with english-language descriptions of the rolls (`description`)
152+
- `dicePools` is an object representing the normalized state of each argument passed to `roll`. This includes a version of the provided dice pool argument as a `DicePoolOption` (`option`), as `RandsumNotation` (`notation`), a `Die` representing a single die in this particular `dicePool` and in an array of strings with english-language descriptions of the rolls (`description`)
153153
- `rawRolls` is an object representing arrays of rolls. It shares keys with `dicePools`, allowing us to easily link pools to rawRolls. Each row should be as long as the `quantity`, rolling the `die` in each `dicePool`.
154154
- `modifiedRolls` is an object as well. It shares keys with `dicePools` and `rawRolls`, and each value represents the rolls and total of the roll after modifiers have been applied.
155155

RANDSUM_DICE_NOTATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ roll({
8989

9090
#### Custom Sides Caveats and Gotchas
9191

92-
- Whenever _any_ dice pool leverages custom dice, the `total` of the `RollResult` will be `0`.
92+
- Whenever _any_ dice pool leverages custom dice, the `total` of the `RandsumRollResult` will be `0`.
9393
- Modifiers are not compatible with custom sides. Under-the-hood, `randsum` is still rolling these as if they were numeric dice, then swapping out the numbers for faces at the end. While modifiers are technically feasible, it would be very easy to code yourself into a confusing place with non-obvious results.
9494
- for example, given the custom faces argument `[6, 5, 4, 3, 2, 1]`, `1` would be considered the "highest" number, and `6` the "lowest`, which would be silly!
9595
- In light of this, modifiers are ignored (if provided in JS) or rejected (in TS) when providing custom sides.

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ const D120 = dieFactory(120)
6060
D120.roll()
6161

6262
//'heads' or 'tails'?
63-
import { Coin } from 'randsum'
64-
65-
Coin.flip()
63+
const Coin = dieFactory(['heads', 'tails'])
64+
Coin.roll()
6665
```
6766

6867
Written in 100% Typescript with strong attention paid to return types. You depend on `randsum` to give you what you expect - just not always the roll you want.

docs/.nojekyll

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/assets/highlight.css

Lines changed: 0 additions & 85 deletions
This file was deleted.

0 commit comments

Comments
 (0)