UNPKG

badgetable

Version:

Helps create summary tables for modules and websites by adding badges through shields.io. It generates complex Markdown code with a simple payload for an easy-to-understand visual overview.

24 lines (21 loc) 734 B
function printMessages( { messages=[], comments=[] } ) { const n = [ [ comments, 'Comment', false ], [ messages, 'Message', true ] ] .forEach( ( a, index ) => { const [ msgs, headline, stop ] = a msgs .forEach( ( msg, rindex, all ) => { rindex === 0 ? console.log( `\n${headline}${all.length > 1 ? 's' : ''}:` ) : '' console.log( ` - ${msg}` ) if( ( all.length - 1 ) === rindex ) { if( stop === true ) { throw new Error("") } } } ) } ) return true } export { printMessages }