UNPKG

@randsum/roller

Version:

A flexible, type-safe dice roller for tabletop RPGs, game development, and probability simulations

17 lines (13 loc) 528 B
import type { ComparisonOptions } from '../../types' import { formatHumanList } from './formatHumanList' export function formatComparisonDescription({ greaterThan, lessThan, exact }: ComparisonOptions & { exact?: number[] }): string[] { const descriptions: string[] = [] if (exact?.length) descriptions.push(formatHumanList(exact)) if (greaterThan !== undefined) descriptions.push(`greater than [${greaterThan}]`) if (lessThan !== undefined) descriptions.push(`less than [${lessThan}]`) return descriptions }