UNPKG

@randsum/dice

Version:

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

20 lines (19 loc) 521 B
export function isD(arg) { return (typeof arg === 'object' && arg !== null && 'type' in arg && 'sides' in arg && 'faces' in arg && 'isCustom' in arg && 'roll' in arg && 'rollSpread' in arg && 'rollModified' in arg && 'toOptions' in arg && (arg.type === 'numeric' || arg.type === 'custom')); } export function isNumericDie(die) { return die.type === 'numeric'; } export function isCustomDie(die) { return die.type === 'custom'; }