UNPKG

@randsum/roller

Version:

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

13 lines (10 loc) 386 B
import type { ComparisonOptions } from '../../types' export function matchesComparison( value: number, { greaterThan, lessThan, exact }: ComparisonOptions & { exact?: number[] } ): boolean { if (exact?.includes(value)) return true if (greaterThan !== undefined && value > greaterThan) return true if (lessThan !== undefined && value < lessThan) return true return false }