index.js 322 B

1234567891011121314151617
  1. 'use strict';
  2. const stringWidth = require('string-width');
  3. const widestLine = input => {
  4. let max = 0;
  5. for (const line of input.split('\n')) {
  6. max = Math.max(max, stringWidth(line));
  7. }
  8. return max;
  9. };
  10. module.exports = widestLine;
  11. // TODO: remove this in the next major version
  12. module.exports.default = widestLine;