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.

wrapString.js 1011B

1234567891011121314151617181920212223242526
  1. "use strict";
  2. var __importDefault = (this && this.__importDefault) || function (mod) {
  3. return (mod && mod.__esModule) ? mod : { "default": mod };
  4. };
  5. Object.defineProperty(exports, "__esModule", { value: true });
  6. exports.wrapString = void 0;
  7. const slice_ansi_1 = __importDefault(require("slice-ansi"));
  8. const string_width_1 = __importDefault(require("string-width"));
  9. /**
  10. * Creates an array of strings split into groups the length of size.
  11. * This function works with strings that contain ASCII characters.
  12. *
  13. * wrapText is different from would-be "chunk" implementation
  14. * in that whitespace characters that occur on a chunk size limit are trimmed.
  15. *
  16. */
  17. const wrapString = (subject, size) => {
  18. let subjectSlice = subject;
  19. const chunks = [];
  20. do {
  21. chunks.push(slice_ansi_1.default(subjectSlice, 0, size));
  22. subjectSlice = slice_ansi_1.default(subjectSlice, size).trim();
  23. } while (string_width_1.default(subjectSlice));
  24. return chunks;
  25. };
  26. exports.wrapString = wrapString;