Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
18 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import { CustomSides, DicePoolOptions } from '../types/options' | ||
import { DiceNotation } from '../types/primitives' | ||
import { RollArgument } from '../types/argument' | ||
import { RollResult } from '../types/results' | ||
import generateResult from './generate-results' | ||
import parseArguments from './parse-arguments' | ||
|
||
function roll( | ||
arg?: number | DicePoolOptions | DiceNotation | CustomSides | ||
): RollResult { | ||
export default function roll(arg?: RollArgument): RollResult { | ||
return generateResult(parseArguments(arg)) | ||
} | ||
|
||
export default roll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
import { CustomSides, DicePoolOptions } from './options' | ||
import { DiceNotation } from './primitives' | ||
|
||
export type RollArgument = | ||
| undefined | ||
export type CoreRollArgument = | ||
| string | ||
| number | ||
| DicePoolOptions<number | string> | ||
| DiceNotation<number | string> | ||
| DicePoolOptions<string> | ||
| DicePoolOptions<number> | ||
| DiceNotation<number> | ||
| DiceNotation<string> | ||
| CustomSides | ||
|
||
export type RollArgument = CoreRollArgument | CoreRollArgument[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters