Skip to content

Commit

Permalink
feat: move up to dirname regardless of glob characters
Browse files Browse the repository at this point in the history
  • Loading branch information
es128 authored and phated committed Jan 27, 2021
1 parent b2aba8e commit f97fb83
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var path = require('path');
var isglob = require('is-glob');

module.exports = function globParent(str) {
while (isglob(str)) str = path.dirname(str);
str += 'a'; // preserves full path in case of trailing path separator
do {str = path.dirname(str)} while (isglob(str));
return str;
};

0 comments on commit f97fb83

Please sign in to comment.