setup-php/node_modules/prompts/dist/util/lines.js
Shivam Mathur 8f9786b73f init
2019-09-06 05:17:43 +05:30

9 lines
292 B
JavaScript

'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);
};