Changeset e29cc2e for trip-planner-front/node_modules/glob-parent/index.js
- Timestamp:
- 11/25/21 22:08:24 (3 years ago)
- Branches:
- master
- Children:
- 8d391a1
- Parents:
- 59329aa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner-front/node_modules/glob-parent/index.js
r59329aa re29cc2e 7 7 var slash = '/'; 8 8 var backslash = /\\/g; 9 var enclosure = /[\{\[].*[\}\]]$/; 10 var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/; 11 var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g; 9 var escaped = /\\([!*?|[\](){}])/g; 12 10 13 11 /** … … 15 13 * @param {Object} opts 16 14 * @param {boolean} [opts.flipBackslashes=true] 17 * @returns {string}18 15 */ 19 16 module.exports = function globParent(str, opts) { … … 26 23 27 24 // special case for strings ending in enclosure containing path separator 28 if ( enclosure.test(str)) {25 if (isEnclosure(str)) { 29 26 str += slash; 30 27 } … … 36 33 do { 37 34 str = pathPosixDirname(str); 38 } while (isGlob (str) || globby.test(str));35 } while (isGlobby(str)); 39 36 40 37 // remove escape chars and return result 41 38 return str.replace(escaped, '$1'); 42 39 }; 40 41 function isEnclosure(str) { 42 var lastChar = str.slice(-1); 43 44 var enclosureStart; 45 switch (lastChar) { 46 case '}': 47 enclosureStart = '{'; 48 break; 49 case ']': 50 enclosureStart = '['; 51 break; 52 default: 53 return false; 54 } 55 56 var foundIndex = str.indexOf(enclosureStart); 57 if (foundIndex < 0) { 58 return false; 59 } 60 61 return str.slice(foundIndex + 1, -1).includes(slash); 62 } 63 64 function isGlobby(str) { 65 if (/\([^()]+$/.test(str)) { 66 return true; 67 } 68 if (str[0] === '{' || str[0] === '[') { 69 return true; 70 } 71 if (/[^\\][{[]/.test(str)) { 72 return true; 73 } 74 return isGlob(str); 75 }
Note:
See TracChangeset
for help on using the changeset viewer.