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-umd.js 13KB

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