'use strict';varpath=require('path');varisglob=require('is-glob');varpathDirname=require('path-dirname');varisWin32=require('os').platform()==='win32';module.exports=functionglobParent(str){// flip windows path separatorsif(isWin32&&str.indexOf('/')<0)str=str.split('\\').join('/');// special case for strings ending in enclosure containing path separatorif(/[\{\[].*[\/]*.*[\}\]]$/.test(str))str+='/';// preserves full path in case of trailing path separatorstr+='a';// remove path parts that are globbydo{str=pathDirname.posix(str)}while(isglob(str)||/(^|[^\\])([\{\[]|\([^\)]+$)/.test(str));// remove escape chars and return resultreturnstr.replace(/\\([\*\?\|\[\]\(\)\{\}])/g,'$1');};