You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
301 B
11 lines
301 B
'use strict'; |
|
|
|
const strip = require('./strip'); |
|
|
|
module.exports = function (msg, perLine = process.stdout.columns) { |
|
let lines = String(strip(msg) || '').split(/\r?\n/); |
|
|
|
if (!perLine) return lines.length; |
|
return lines.map(l => Math.ceil(l.length / perLine)) |
|
.reduce((a, b) => a + b); |
|
};
|
|
|