UNPKG

@randsum/notation

Version:

Dice notation parser and types for the @randsum ecosystem

9 lines (7 loc) 259 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}` }