UNPKG

@randsum/roller

Version:

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

9 lines (7 loc) 263 B
export function formatHumanList(values: number[]): string { if (!values.length) return '' if (values.length === 1) return `[${values[0]}]` const items = values.map(item => `[${item}]`) const last = items.pop() return `${items.join(' ')} and ${last}` }