@randsum/roller
Version:
A flexible, type-safe dice roller for tabletop RPGs, game development, and probability simulations
11 lines (8 loc) • 393 B
text/typescript
import type { RerollOptions } from '../../../types'
import { formatComparisonNotation } from '../../comparisonUtils'
export function formatRerollNotation(options: RerollOptions): string | undefined {
const parts = formatComparisonNotation(options)
if (!parts.length) return undefined
const maxSuffix = options.max ? `${options.max}` : ''
return `R{${parts.join(',')}}${maxSuffix}`
}