src/index.js
function parent(str, { strict = false } = {}) {
  str = path.normalize(str).replace(/\/|\\/, '/');

  // special case for strings ending in enclosure containing path separator
  if (/[\{\[].*[\/]*.*[\}\]]$/.test(str)) str += '/';

  // preserves full path in case of trailing path separator
  str += 'a';

  do {str = path.dirname(str)}
  while (isglob(str, {strict}) || /(^|[^\\])([\{\[]|\([^\)]+$)/.test(str));

  // remove escape chars and return result
  return str.replace(/\\([\*\?\|\[\]\(\)\{\}])/g, '$1');
}
function parent(str, { strict = false } = {}) {
  str = path.normalize(str).replace(/\/|\\/, '/');

  // special case for strings ending in enclosure containing path separator
  if (/[\{\[].*[\/]*.*[\}\]]$/.test(str)) str += '/';

  // preserves full path in case of trailing path separator
  str += 'a';

  do {str = path.dirname(str)}
  while (isglob(str, {strict}) || /(^|[^\\])([\{\[]|\([^\)]+$)/.test(str));

  // remove escape chars and return result
  return str.replace(/\\([\*\?\|\[\]\(\)\{\}])/g, '$1');
}
function parent ( str , { strict = false } = { } ) { str = path . normalize ( str ) . replace ( / \/|\\ / , '/' ) ; // special case for strings ending in enclosure containing path separator if ( / [\{\[].*[\/]*.*[\}\]]$ / . test ( str ) ) str += '/' ; // preserves full path in case of trailing path separator str += 'a' ; do { str = path . dirname ( str ) } while ( isglob ( str , { strict } ) || / (^|[^\\])([\{\[]|\([^\)]+$) / . test ( str ) ) ; // remove escape chars and return result return str . replace ( / \\([\*\?\|\[\]\(\)\{\}]) / g , '$1' ) ; }
Find the static part of a glob-path,
split path and return path part
@param {String} str Path/glob string
@returns {String} static path section of glob
Find the static part of a glob - path split path and return path part