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-generators.js 962B

123456789101112131415161718192021222324252627282930313233343536
  1. /* eslint-disable node/no-unsupported-features/es-syntax */
  2. // We copy the regular expression so as to be able to always
  3. // ensure the exec expression is a global one (and thereby prevent recursion)
  4. /**
  5. *
  6. * @param {RegExtras} RegExtras
  7. * @returns {void}
  8. */
  9. function addPrototypeMethods (RegExtras) {
  10. RegExtras.prototype.entries = function * (str) {
  11. let matches, i = 0;
  12. const regex = RegExtras.mixinRegex(this.regex, 'g');
  13. while ((matches = regex.exec(str)) !== null) {
  14. yield [i++, matches];
  15. }
  16. };
  17. RegExtras.prototype.values = function * (str) {
  18. let matches;
  19. const regex = RegExtras.mixinRegex(this.regex, 'g');
  20. while ((matches = regex.exec(str)) !== null) {
  21. yield matches;
  22. }
  23. };
  24. RegExtras.prototype.keys = function * (str) {
  25. let i = 0;
  26. const regex = RegExtras.mixinRegex(this.regex, 'g');
  27. while (regex.exec(str) !== null) {
  28. yield i++;
  29. }
  30. };
  31. }
  32. export default addPrototypeMethods;