Skip to content

Commit

Permalink
feat: make regex test strings smaller
Browse files Browse the repository at this point in the history
By only evaluating the last path section on each pass
  • Loading branch information
es128 authored and phated committed Jan 27, 2021
1 parent 08f2ce2 commit cd83220
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ var path = require('path');
var isglob = require('is-glob');

module.exports = function globParent(str) {
while (isglob(str)) str = path.dirname(str);
while (isglob(path.basename(str))) str = path.dirname(str);
return str;
};

0 comments on commit cd83220

Please sign in to comment.