This repository has been archived on 2022-03-12. You can view files and clone it, but cannot push or open issues or pull requests.

16 lines
334 B
JavaScript
Raw Permalink Normal View History

2021-04-02 02:24:13 +03:00
'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);
};