From f97fb83be2e0a9fc8d3b760e789d2ecadd6aa0c2 Mon Sep 17 00:00:00 2001 From: Elan Shanker Date: Wed, 9 Sep 2015 09:43:21 -0400 Subject: [PATCH] feat: move up to dirname regardless of glob characters --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index cb03219..61615f1 100644 --- a/index.js +++ b/index.js @@ -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; };