Ignore:
Timestamp:
11/25/21 22:08:24 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
8d391a1
Parents:
59329aa
Message:

primeNG components

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trip-planner-front/node_modules/glob-parent/index.js

    r59329aa re29cc2e  
    77var slash = '/';
    88var backslash = /\\/g;
    9 var enclosure = /[\{\[].*[\}\]]$/;
    10 var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
    11 var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
     9var escaped = /\\([!*?|[\](){}])/g;
    1210
    1311/**
     
    1513 * @param {Object} opts
    1614 * @param {boolean} [opts.flipBackslashes=true]
    17  * @returns {string}
    1815 */
    1916module.exports = function globParent(str, opts) {
     
    2623
    2724  // special case for strings ending in enclosure containing path separator
    28   if (enclosure.test(str)) {
     25  if (isEnclosure(str)) {
    2926    str += slash;
    3027  }
     
    3633  do {
    3734    str = pathPosixDirname(str);
    38   } while (isGlob(str) || globby.test(str));
     35  } while (isGlobby(str));
    3936
    4037  // remove escape chars and return result
    4138  return str.replace(escaped, '$1');
    4239};
     40
     41function 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
     64function 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.