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.

indent.cjs 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. "use strict";
  2. var __rest = this && this.__rest || function (s, e) {
  3. var t = {};
  4. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
  5. if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
  6. if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
  7. }
  8. return t;
  9. };
  10. Object.defineProperty(exports, "__esModule", {
  11. value: true
  12. });
  13. const util_1 = require("../util.cjs");
  14. const pull = offset => str => str.slice(offset);
  15. const push = offset => {
  16. const space = ''.padStart(offset, ' ');
  17. return str => str + space;
  18. };
  19. function indent(pos) {
  20. let shift;
  21. const pad = start => {
  22. if (shift === undefined) {
  23. const offset = pos - start.length;
  24. shift = offset > 0 ? push(offset) : pull(-offset);
  25. }
  26. return shift(start);
  27. };
  28. const update = line => Object.assign(Object.assign({}, line), {
  29. tokens: Object.assign(Object.assign({}, line.tokens), {
  30. start: pad(line.tokens.start)
  31. })
  32. });
  33. return _a => {
  34. var {
  35. source
  36. } = _a,
  37. fields = __rest(_a, ["source"]);
  38. return util_1.rewireSource(Object.assign(Object.assign({}, fields), {
  39. source: source.map(update)
  40. }));
  41. };
  42. }
  43. exports.default = indent;
  44. //# sourceMappingURL=indent.cjs.map