Dieses Repository beinhaltet HTML- und Javascript Code zur einer NotizenWebApp auf Basis von Web Storage. Zudem sind Mocha/Chai Tests im Browser enthalten. https://meinenotizen.netlify.app/
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

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. 'use strict';
  2. var isGlob = require('is-glob');
  3. var pathPosixDirname = require('path').posix.dirname;
  4. var isWin32 = require('os').platform() === 'win32';
  5. var slash = '/';
  6. var backslash = /\\/g;
  7. var enclosure = /[\{\[].*[\/]*.*[\}\]]$/;
  8. var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
  9. var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
  10. /**
  11. * @param {string} str
  12. * @param {Object} opts
  13. * @param {boolean} [opts.flipBackslashes=true]
  14. */
  15. module.exports = function globParent(str, opts) {
  16. var options = Object.assign({ flipBackslashes: true }, opts);
  17. // flip windows path separators
  18. if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
  19. str = str.replace(backslash, slash);
  20. }
  21. // special case for strings ending in enclosure containing path separator
  22. if (enclosure.test(str)) {
  23. str += slash;
  24. }
  25. // preserves full path in case of trailing path separator
  26. str += 'a';
  27. // remove path parts that are globby
  28. do {
  29. str = pathPosixDirname(str);
  30. } while (isGlob(str) || globby.test(str));
  31. // remove escape chars and return result
  32. return str.replace(escaped, '$1');
  33. };