
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
Returns an object with the (non-glob) base path and the actual pattern.
Use glob-parent if you just want the base path.
npm i glob-base --save
true if the given string looks like a glob pattern.var globBase = require('glob-base');
globBase('a/b/.git/');
//=> { base: 'a/b/.git/', isGlob: false, glob: '' })
globBase('a/b/**/e');
//=> { base: 'a/b', isGlob: true, glob: '**/e' }
globBase('a/b/*.{foo,bar}');
//=> { base: 'a/b', isGlob: true, glob: '*.{foo,bar}' }
globBase('a/b/.git/**');
//=> { base: 'a/b/.git', isGlob: true, glob: '**' }
globBase('a/b/c/*.md');
//=> { base: 'a/b/c', isGlob: true, glob: '*.md' }
globBase('a/b/c/.*.md');
//=> { base: 'a/b/c', isGlob: true, glob: '.*.md' }
globBase('a/b/{c,d}');
//=> { base: 'a/b', isGlob: true, glob: '{c,d}' }
globBase('!*.min.js');
//=> { base: '.', isGlob: true, glob: '!*.min.js' }
globBase('!foo');
//=> { base: '.', isGlob: true, glob: '!foo' }
globBase('!foo/(a|b).min.js');
//=> { base: '.', isGlob: true, glob: '!foo/(a|b).min.js' }
globBase('');
//=> { base: '.', isGlob: false, glob: '' }
globBase('**/*.md');
//=> { base: '.', isGlob: true, glob: '**/*.md' }
globBase('**/*.min.js');
//=> { base: '.', isGlob: true, glob: '**/*.min.js' }
globBase('**/.*');
//=> { base: '.', isGlob: true, glob: '**/.*' }
globBase('**/d');
//=> { base: '.', isGlob: true, glob: '**/d' }
globBase('*.*');
//=> { base: '.', isGlob: true, glob: '*.*' }
globBase('*.min.js');
//=> { base: '.', isGlob: true, glob: '*.min.js' }
globBase('*/*');
//=> { base: '.', isGlob: true, glob: '*/*' }
globBase('*b');
//=> { base: '.', isGlob: true, glob: '*b' }
globBase('.');
//=> { base: '.', isGlob: false, glob: '.' }
globBase('.*');
//=> { base: '.', isGlob: true, glob: '.*' }
globBase('./*');
//=> { base: '.', isGlob: true, glob: '*' }
globBase('/a');
//=> { base: '/', isGlob: false, glob: 'a' }
globBase('@(a|b)/e.f.g/');
//=> { base: '.', isGlob: true, glob: '@(a|b)/e.f.g/' }
globBase('[a-c]b*');
//=> { base: '.', isGlob: true, glob: '[a-c]b*' }
globBase('a');
//=> { base: '.', isGlob: false, glob: 'a' }
globBase('a.min.js');
//=> { base: '.', isGlob: false, glob: 'a.min.js' }
globBase('a/');
//=> { base: 'a/', isGlob: false, glob: '' }
globBase('a/**/j/**/z/*.md');
//=> { base: 'a', isGlob: true, glob: '**/j/**/z/*.md' }
globBase('a/*/c/*.md');
//=> { base: 'a', isGlob: true, glob: '*/c/*.md' }
globBase('a/?/c.md');
//=> { base: 'a', isGlob: true, glob: '?/c.md' }
globBase('a/??/c.js');
//=> { base: 'a', isGlob: true, glob: '??/c.js' }
globBase('a?b');
//=> { base: '.', isGlob: true, glob: 'a?b' }
globBase('bb');
//=> { base: '.', isGlob: false, glob: 'bb' }
globBase('c.md');
//=> { base: '.', isGlob: false, glob: 'c.md' }
Install dev dependencies.
npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Jon Schlinkert
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license
This file was generated by verb-cli on March 08, 2015.
Minimatch is a package that provides a similar functionality to glob-base by allowing pattern matching using glob patterns. However, it focuses more on matching file paths against patterns rather than extracting base paths and glob patterns separately. It is more comprehensive in terms of pattern matching capabilities.
Micromatch is another package that offers advanced globbing features. It is more powerful and flexible than glob-base, providing extensive pattern matching capabilities, including support for regex and custom matching functions. While glob-base is focused on splitting the base and glob, micromatch is designed for complex pattern matching tasks.
FAQs
Returns an object with the (non-glob) base path and the actual pattern.
The npm package glob-base receives a total of 2,555,253 weekly downloads. As such, glob-base popularity was classified as popular.
We found that glob-base demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.