UNPKG

dce-selenium

Version:

Selenium library to simplify testing and automatically snapshot the DOM.

26 lines (20 loc) 727 B
/*------------------------------------------------------------------------*/ /* Printing Helpers */ /*------------------------------------------------------------------------*/ /* eslint-disable no-console */ const W = process.stdout.columns; const leftBuffer = (message, padding) => { return (Math.floor(W / 2) - padding - Math.ceil(message.length / 2)); }; const rightBuffer = (message, padding) => { return (Math.ceil(W / 2) - padding - Math.floor(message.length / 2)); }; module.exports = (str, border) => { return ( border + ' '.repeat(leftBuffer(str, border.length)) + str + ' '.repeat(rightBuffer(str, border.length)) + border ); };