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.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*!
  2. * is-glob <https://github.com/jonschlinkert/is-glob>
  3. *
  4. * Copyright (c) 2014-2017, Jon Schlinkert.
  5. * Released under the MIT License.
  6. */
  7. var isExtglob = require('is-extglob');
  8. var chars = { '{': '}', '(': ')', '[': ']'};
  9. var strictRegex = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/;
  10. var relaxedRegex = /\\(.)|(^!|[*?{}()[\]]|\(\?)/;
  11. module.exports = function isGlob(str, options) {
  12. if (typeof str !== 'string' || str === '') {
  13. return false;
  14. }
  15. if (isExtglob(str)) {
  16. return true;
  17. }
  18. var regex = strictRegex;
  19. var match;
  20. // optionally relax regex
  21. if (options && options.strict === false) {
  22. regex = relaxedRegex;
  23. }
  24. while ((match = regex.exec(str))) {
  25. if (match[2]) return true;
  26. var idx = match.index + match[0].length;
  27. // if an open bracket/brace/paren is escaped,
  28. // set the index to the next closing character
  29. var open = match[1];
  30. var close = open ? chars[open] : null;
  31. if (open && close) {
  32. var n = str.indexOf(close, idx);
  33. if (n !== -1) {
  34. idx = n + 1;
  35. }
  36. }
  37. str = str.slice(idx);
  38. }
  39. return false;
  40. };