@randsum/roller
Version:
A flexible, type-safe dice roller for tabletop RPGs, game development, and probability simulations
16 lines (12 loc) • 431 B
text/typescript
import type { ComparisonOptions } from '../../types'
export function formatComparisonNotation({
greaterThan,
lessThan,
exact
}: ComparisonOptions & { exact?: number[] }): string[] {
const notations: string[] = []
if (exact?.length) notations.push(...exact.map(String))
if (greaterThan !== undefined) notations.push(`>${greaterThan}`)
if (lessThan !== undefined) notations.push(`<${lessThan}`)
return notations
}