Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

lines.js 326B

1234567891011121314
  1. 'use strict';
  2. const strip = require('./strip');
  3. /**
  4. * @param {string} msg
  5. * @param {number} perLine
  6. */
  7. module.exports = function (msg, perLine) {
  8. let lines = String(strip(msg) || '').split(/\r?\n/);
  9. if (!perLine) return lines.length;
  10. return lines.map(l => Math.ceil(l.length / perLine)).reduce((a, b) => a + b);
  11. };