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.

16 lines
334 B

1 month ago
'use strict';
const strip = require('./strip');
/**
* @param {string} msg
* @param {number} perLine
*/
module.exports = function (msg, perLine) {
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);
};