Skip to content

Commit

Permalink
Fix Replace Bug (4.6.1) (#620)
Browse files Browse the repository at this point in the history
  • Loading branch information
alxjrvs authored Sep 7, 2024
1 parent 477ba52 commit dc60256
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "randsum",
"version": "4.6.0",
"version": "4.6.1",
"private": false,
"author": "Alex Jarvis",
"icon": "https://raw.githubusercontent.com/RANDSUM/randsum-ts/main/icon.webp",
Expand Down
2 changes: 1 addition & 1 deletion src/matchPattern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const dropConstraintsPattern = /[Dd]{([<>]?\d+,)*([<>]?\d+)}/g
export const explodePattern = /!/g
export const uniquePattern = /[Uu]({(\d+,)*(\d+)})?/g
export const replacePattern = /[Vv]{([<>]?\d+=?\d+,)*([<>]?\d+=?\d+)}/g
export const rerollPattern = /[Rr]{([<>]?\d,)*([<>]?\d)}\d*/g
export const rerollPattern = /[Rr]{([<>]?\d+,)*([<>]?\d+)}\d*/g
export const capPattern = /[Cc]{([<>]?\d+,)*([<>]?\d+)}/g
export const plusPattern = /\+\d+/g
export const minusPattern = /-\d+/g
8 changes: 4 additions & 4 deletions tests/parseRollArguments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ describe('parseRollArguments', () => {
})

describe('given a notation that contains a reroll modifier', () => {
const argument: DiceNotation = `${coreTestString}R{5,<6,>2}3`
const argument: DiceNotation = `${coreTestString}R{5,20,<6,>2}3`

test('returns a RollParameter matching the notation', () => {
const params = parseRollArguments(argument)
Expand All @@ -431,18 +431,18 @@ describe('parseRollArguments', () => {
...coreRollParameters,
modifiers: {
reroll: {
exact: [5],
exact: [5, 20],
lessThan: 6,
greaterThan: 2,
maxReroll: 3
}
}
},
die: new StandardDie(coreRollParameters.sides),
notation: '4d6R{5,>2,<6}3',
notation: '4d6R{5,20,>2,<6}3',
description: [
'Roll 4 6-sided dice',
'Reroll [5], greater than [2] and less than [6] (up to 3 times)'
'Reroll [5] and [20], greater than [2] and less than [6] (up to 3 times)'
]
})
})
Expand Down

0 comments on commit dc60256

Please sign in to comment.