Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
alxjrvs committed Sep 24, 2024
1 parent b88035e commit 922d5bb
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/models/ArgumentsModel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,25 @@ function formDicePools<Sides extends string | number = string | number>(
}

function toOptions(argument: RandsumRollArgument): RandsumRollOptions {
if (isD(argument)) {
return argument.toOptions()
}

if (isDicePoolOptions(argument)) {
return argument
}

if (isD(argument)) {
return argument.toOptions()
}

if (isDiceNotationArg(argument)) {
return NotationModel.toOptions(argument)
}

if (Array.isArray(argument)) {
return {
quantity: 1,
sides: argument.map(String)
}
}
const sides = Array.isArray(argument)
? argument.map(String)
: Number(argument)

return {
quantity: 1,
sides: Number(argument || 20)
sides
}
}

Expand Down

0 comments on commit 922d5bb

Please sign in to comment.