@randsum/dice
Version:
A flexible, type-safe dice roller for tabletop RPGs, game development, and probability simulations
14 lines (10 loc) • 317 B
text/typescript
import type { RollResult, SingleRollResult } from '../types'
export function rollType(rolls: SingleRollResult[]): RollResult['type'] {
if (rolls.every((roll) => roll.type === 'numeric')) {
return 'numeric'
}
if (rolls.every((roll) => roll.type === 'custom')) {
return 'custom'
}
return 'mixed'
}