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.

index-es.js 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. function _classCallCheck(instance, Constructor) {
  2. if (!(instance instanceof Constructor)) {
  3. throw new TypeError("Cannot call a class as a function");
  4. }
  5. }
  6. function _defineProperties(target, props) {
  7. for (var i = 0; i < props.length; i++) {
  8. var descriptor = props[i];
  9. descriptor.enumerable = descriptor.enumerable || false;
  10. descriptor.configurable = true;
  11. if ("value" in descriptor) descriptor.writable = true;
  12. Object.defineProperty(target, descriptor.key, descriptor);
  13. }
  14. }
  15. function _createClass(Constructor, protoProps, staticProps) {
  16. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  17. if (staticProps) _defineProperties(Constructor, staticProps);
  18. return Constructor;
  19. }
  20. function _setPrototypeOf(o, p) {
  21. _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
  22. o.__proto__ = p;
  23. return o;
  24. };
  25. return _setPrototypeOf(o, p);
  26. }
  27. function _isNativeReflectConstruct() {
  28. if (typeof Reflect === "undefined" || !Reflect.construct) return false;
  29. if (Reflect.construct.sham) return false;
  30. if (typeof Proxy === "function") return true;
  31. try {
  32. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
  33. return true;
  34. } catch (e) {
  35. return false;
  36. }
  37. }
  38. function _construct(Parent, args, Class) {
  39. if (_isNativeReflectConstruct()) {
  40. _construct = Reflect.construct;
  41. } else {
  42. _construct = function _construct(Parent, args, Class) {
  43. var a = [null];
  44. a.push.apply(a, args);
  45. var Constructor = Function.bind.apply(Parent, a);
  46. var instance = new Constructor();
  47. if (Class) _setPrototypeOf(instance, Class.prototype);
  48. return instance;
  49. };
  50. }
  51. return _construct.apply(null, arguments);
  52. }
  53. /* eslint-disable node/no-unsupported-features/es-syntax */
  54. /**
  55. * @param {RegExp} regex
  56. * @param {string} newFlags
  57. * @param {Integer} [newLastIndex=regex.lastIndex]
  58. * @returns {RegExp}
  59. */
  60. function mixinRegex(regex, newFlags) {
  61. var newLastIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : regex.lastIndex;
  62. newFlags = newFlags || '';
  63. regex = new RegExp(regex.source, (newFlags.includes('g') ? 'g' : regex.global ? 'g' : '') + (newFlags.includes('i') ? 'i' : regex.ignoreCase ? 'i' : '') + (newFlags.includes('m') ? 'm' : regex.multiline ? 'm' : '') + (newFlags.includes('u') ? 'u' : regex.unicode ? 'u' : '') + (newFlags.includes('y') ? 'y' : regex.sticky ? 'y' : '') + (newFlags.includes('s') ? 's' : regex.dotAll ? 's' : ''));
  64. regex.lastIndex = newLastIndex;
  65. return regex;
  66. }
  67. var RegExtras = /*#__PURE__*/function () {
  68. function RegExtras(regex, flags, newLastIndex) {
  69. _classCallCheck(this, RegExtras);
  70. this.regex = mixinRegex(typeof regex === 'string' ? new RegExp(regex) : mixinRegex(regex), flags || '', newLastIndex);
  71. }
  72. _createClass(RegExtras, [{
  73. key: "forEach",
  74. value: function forEach(str, cb) {
  75. var thisObj = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  76. var regex = mixinRegex(this.regex, 'g');
  77. var matches,
  78. n0,
  79. i = 0;
  80. while ((matches = regex.exec(str)) !== null) {
  81. n0 = matches.splice(0, 1);
  82. cb.apply(thisObj, matches.concat(i++, n0));
  83. }
  84. return this;
  85. }
  86. }, {
  87. key: "some",
  88. value: function some(str, cb) {
  89. var thisObj = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  90. var regex = mixinRegex(this.regex, 'g');
  91. var matches,
  92. ret,
  93. n0,
  94. i = 0;
  95. while ((matches = regex.exec(str)) !== null) {
  96. n0 = matches.splice(0, 1);
  97. ret = cb.apply(thisObj, matches.concat(i++, n0));
  98. if (ret) {
  99. return true;
  100. }
  101. }
  102. return false;
  103. }
  104. }, {
  105. key: "every",
  106. value: function every(str, cb) {
  107. var thisObj = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  108. var regex = mixinRegex(this.regex, 'g');
  109. var matches,
  110. ret,
  111. n0,
  112. i = 0;
  113. while ((matches = regex.exec(str)) !== null) {
  114. n0 = matches.splice(0, 1);
  115. ret = cb.apply(thisObj, matches.concat(i++, n0));
  116. if (!ret) {
  117. return false;
  118. }
  119. }
  120. return true;
  121. }
  122. }, {
  123. key: "map",
  124. value: function map(str, cb) {
  125. var thisObj = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  126. var ret = [];
  127. var regex = mixinRegex(this.regex, 'g');
  128. var matches,
  129. n0,
  130. i = 0;
  131. while ((matches = regex.exec(str)) !== null) {
  132. n0 = matches.splice(0, 1);
  133. ret.push(cb.apply(thisObj, matches.concat(i++, n0)));
  134. }
  135. return ret;
  136. }
  137. }, {
  138. key: "filter",
  139. value: function filter(str, cb) {
  140. var thisObj = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  141. var matches,
  142. n0,
  143. i = 0;
  144. var ret = [],
  145. regex = mixinRegex(this.regex, 'g');
  146. while ((matches = regex.exec(str)) !== null) {
  147. n0 = matches.splice(0, 1);
  148. matches = matches.concat(i++, n0);
  149. if (cb.apply(thisObj, matches)) {
  150. ret.push(n0[0]);
  151. }
  152. }
  153. return ret;
  154. }
  155. }, {
  156. key: "reduce",
  157. value: function reduce(str, cb, prev) {
  158. var thisObj = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  159. var matches,
  160. n0,
  161. i = 0;
  162. var regex = mixinRegex(this.regex, 'g');
  163. if (!prev) {
  164. if ((matches = regex.exec(str)) !== null) {
  165. n0 = matches.splice(0, 1);
  166. prev = cb.apply(thisObj, [''].concat(matches.concat(i++, n0)));
  167. }
  168. }
  169. while ((matches = regex.exec(str)) !== null) {
  170. n0 = matches.splice(0, 1);
  171. prev = cb.apply(thisObj, [prev].concat(matches.concat(i++, n0)));
  172. }
  173. return prev;
  174. }
  175. }, {
  176. key: "reduceRight",
  177. value: function reduceRight(str, cb, prevOrig, thisObjOrig) {
  178. var matches,
  179. n0,
  180. i,
  181. thisObj = thisObjOrig,
  182. prev = prevOrig;
  183. var matchesContainer = [],
  184. regex = mixinRegex(this.regex, 'g');
  185. thisObj = thisObj || null;
  186. while ((matches = regex.exec(str)) !== null) {
  187. matchesContainer.push(matches);
  188. }
  189. i = matchesContainer.length;
  190. if (!i) {
  191. if (arguments.length < 3) {
  192. throw new TypeError('reduce of empty matches array with no initial value');
  193. }
  194. return prev;
  195. }
  196. if (!prev) {
  197. matches = matchesContainer.splice(-1)[0];
  198. n0 = matches.splice(0, 1);
  199. prev = cb.apply(thisObj, [''].concat(matches.concat(i--, n0)));
  200. }
  201. matchesContainer.reduceRight(function (container, mtches) {
  202. n0 = mtches.splice(0, 1);
  203. prev = cb.apply(thisObj, [prev].concat(mtches.concat(i--, n0)));
  204. return container;
  205. }, matchesContainer);
  206. return prev;
  207. }
  208. }, {
  209. key: "find",
  210. value: function find(str, cb) {
  211. var thisObj = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  212. var matches,
  213. ret,
  214. n0,
  215. i = 0;
  216. var regex = mixinRegex(this.regex, 'g');
  217. while ((matches = regex.exec(str)) !== null) {
  218. n0 = matches.splice(0, 1);
  219. ret = cb.apply(thisObj, matches.concat(i++, n0));
  220. if (ret) {
  221. return n0[0];
  222. }
  223. }
  224. return false;
  225. }
  226. }, {
  227. key: "findIndex",
  228. value: function findIndex(str, cb) {
  229. var thisObj = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  230. var regex = mixinRegex(this.regex, 'g');
  231. var matches,
  232. i = 0;
  233. while ((matches = regex.exec(str)) !== null) {
  234. var n0 = matches.splice(0, 1);
  235. var ret = cb.apply(thisObj, matches.concat(i++, n0));
  236. if (ret) {
  237. return i - 1;
  238. }
  239. }
  240. return -1;
  241. }
  242. }, {
  243. key: "findExec",
  244. value: function findExec(str, cb) {
  245. var thisObj = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  246. var regex = mixinRegex(this.regex, 'g');
  247. var matches,
  248. i = 0;
  249. while ((matches = regex.exec(str)) !== null) {
  250. var n0 = matches.splice(0, 1);
  251. var ret = cb.apply(thisObj, matches.concat(i++, n0));
  252. if (ret) {
  253. return matches;
  254. }
  255. }
  256. return false;
  257. }
  258. }, {
  259. key: "filterExec",
  260. value: function filterExec(str, cb) {
  261. var thisObj = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  262. var matches,
  263. n0,
  264. i = 0;
  265. var ret = [],
  266. regex = mixinRegex(this.regex, 'g');
  267. while ((matches = regex.exec(str)) !== null) {
  268. n0 = matches.splice(0, 1);
  269. matches.push(i++, n0[0]);
  270. if (cb.apply(thisObj, matches)) {
  271. ret.push(matches);
  272. }
  273. }
  274. return ret;
  275. }
  276. }]);
  277. return RegExtras;
  278. }();
  279. var _RegExtras = RegExtras;
  280. RegExtras = function RegExtras() {
  281. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  282. args[_key] = arguments[_key];
  283. }
  284. // eslint-disable-line no-class-assign
  285. return _construct(_RegExtras, args);
  286. };
  287. RegExtras.prototype = _RegExtras.prototype;
  288. RegExtras.mixinRegex = mixinRegex;
  289. /* eslint-disable node/no-unsupported-features/es-syntax */
  290. // We copy the regular expression so as to be able to always
  291. // ensure the exec expression is a global one (and thereby prevent recursion)
  292. /**
  293. *
  294. * @param {RegExtras} RegExtras
  295. * @returns {void}
  296. */
  297. function addPrototypeMethods(RegExtras) {
  298. RegExtras.prototype.entries = /*#__PURE__*/regeneratorRuntime.mark(function _callee(str) {
  299. var matches, i, regex;
  300. return regeneratorRuntime.wrap(function _callee$(_context) {
  301. while (1) {
  302. switch (_context.prev = _context.next) {
  303. case 0:
  304. i = 0;
  305. regex = RegExtras.mixinRegex(this.regex, 'g');
  306. case 2:
  307. if (!((matches = regex.exec(str)) !== null)) {
  308. _context.next = 7;
  309. break;
  310. }
  311. _context.next = 5;
  312. return [i++, matches];
  313. case 5:
  314. _context.next = 2;
  315. break;
  316. case 7:
  317. case "end":
  318. return _context.stop();
  319. }
  320. }
  321. }, _callee, this);
  322. });
  323. RegExtras.prototype.values = /*#__PURE__*/regeneratorRuntime.mark(function _callee2(str) {
  324. var matches, regex;
  325. return regeneratorRuntime.wrap(function _callee2$(_context2) {
  326. while (1) {
  327. switch (_context2.prev = _context2.next) {
  328. case 0:
  329. regex = RegExtras.mixinRegex(this.regex, 'g');
  330. case 1:
  331. if (!((matches = regex.exec(str)) !== null)) {
  332. _context2.next = 6;
  333. break;
  334. }
  335. _context2.next = 4;
  336. return matches;
  337. case 4:
  338. _context2.next = 1;
  339. break;
  340. case 6:
  341. case "end":
  342. return _context2.stop();
  343. }
  344. }
  345. }, _callee2, this);
  346. });
  347. RegExtras.prototype.keys = /*#__PURE__*/regeneratorRuntime.mark(function _callee3(str) {
  348. var i, regex;
  349. return regeneratorRuntime.wrap(function _callee3$(_context3) {
  350. while (1) {
  351. switch (_context3.prev = _context3.next) {
  352. case 0:
  353. i = 0;
  354. regex = RegExtras.mixinRegex(this.regex, 'g');
  355. case 2:
  356. if (!(regex.exec(str) !== null)) {
  357. _context3.next = 7;
  358. break;
  359. }
  360. _context3.next = 5;
  361. return i++;
  362. case 5:
  363. _context3.next = 2;
  364. break;
  365. case 7:
  366. case "end":
  367. return _context3.stop();
  368. }
  369. }
  370. }, _callee3, this);
  371. });
  372. }
  373. addPrototypeMethods(RegExtras);
  374. export { RegExtras, mixinRegex };