Parse a glob pattern into an object of path parts.
Installations
npm install parse-glob
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=0.10.0
Node Version
0.12.4
NPM Version
2.10.1
Score
99.1
Supply Chain
99.4
Quality
75.3
Maintenance
100
Vulnerability
100
License
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
Download Statistics
Total Downloads
1,342,720,064
Last Day
318,203
Last Week
1,435,743
Last Month
7,168,027
Last Year
102,062,664
GitHub Statistics
25 Stars
48 Commits
8 Forks
6 Watching
1 Branches
6 Contributors
Bundle Size
2.80 kB
Minified
1.05 kB
Minified + Gzipped
Package Meta Information
Latest Version
3.0.4
Package Id
parse-glob@3.0.4
Size
3.90 kB
NPM Version
2.10.1
Node Version
0.12.4
Publised On
22 Sept 2015
Total Downloads
Cumulative downloads
Total Downloads
1,342,720,064
Last day
-5.9%
318,203
Compared to previous day
Last week
-19.6%
1,435,743
Compared to previous week
Last month
7%
7,168,027
Compared to previous month
Last year
-6.6%
102,062,664
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
4
Dev Dependencies
3
parse-glob
![Build Status](https://travis-ci.org/jonschlinkert/parse-glob.svg)
Parse a glob pattern into an object of tokens.
Changes from v1.0.0 to v3.0.4
- all path-related properties are now on the
path
object - all boolean properties are now on the
is
object - adds
base
property
See the properties section for details.
Install with npm
1$ npm i parse-glob --save
- parses 1,000+ glob patterns in 29ms (2.3 GHz Intel Core i7)
- Extensive unit tests (more than 1,000 lines), covering wildcards, globstars, character classes, brace patterns, extglobs, dotfiles and other complex patterns.
See the tests for hundreds of examples.
Usage
1var parseGlob = require('parse-glob');
Example
1parseGlob('a/b/c/**/*.{yml,json}');
Returns:
1{ orig: 'a/b/c/**/*.{yml,json}', 2 is: 3 { glob: true, 4 negated: false, 5 extglob: false, 6 braces: true, 7 brackets: false, 8 globstar: true, 9 dotfile: false, 10 dotdir: false }, 11 glob: '**/*.{yml,json}', 12 base: 'a/b/c', 13 path: 14 { dirname: 'a/b/c/**/', 15 basename: '*.{yml,json}', 16 filename: '*', 17 extname: '.{yml,json}', 18 ext: '{yml,json}' } }
Properties
The object returned by parseGlob has the following properties:
orig
: a copy of the original, unmodified glob patternis
: an object with boolean information about the glob:glob
: true if the pattern actually a glob patternnegated
: true if it's a negation pattern (!**/foo.js
)extglob
: true if it has extglobs (@(foo|bar)
)braces
: true if it has braces ({1..2}
or.{txt,md}
)brackets
: true if it has POSIX brackets ([[:alpha:]]
)globstar
: true if the pattern has a globstar (double star,**
)dotfile
: true if the pattern should match dotfilesdotdir
: true if the pattern should match dot-directories (like.git
)
glob
: the glob pattern part of the string, if anybase
: the non-glob part of the string, if anypath
: file path segmentsdirname
: directorybasename
: file name with extensionfilename
: file name without extensionextname
: file extension with dotext
: file extension without dot
Related
- glob-base: Returns an object with the (non-glob) base path and the actual pattern. | homepage
- glob-parent: Strips glob magic from a string to provide the parent path | homepage
- glob-path-regex: Regular expression for matching the parts of glob pattern. | homepage
- is-glob: Returns
true
if the given string looks like a glob pattern. | homepage - micromatch: Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. Just… more | homepage
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Tests
Install dev dependencies:
1$ npm i -d && npm test
Author
Jon Schlinkert
License
Copyright © 2014-2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on September 22, 2015.
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
security policy file detected
Details
- Info: security policy file detected: github.com/micromatch/.github/SECURITY.md:1
- Info: Found linked content: github.com/micromatch/.github/SECURITY.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/micromatch/.github/SECURITY.md:1
- Info: Found text in security policy: github.com/micromatch/.github/SECURITY.md:1
Reason
Found 2/28 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 4 are checked with a SAST tool
Score
3.9
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to parse-glob
@types/parse-glob
TypeScript definitions for parse-glob
babel-extract-comments
Uses babel (babylon) to extract JavaScript code comments from a JavaScript string or file.
esprima-extract-comments
Extract code comments from string or from a glob of files using esprima.
glob-parse
Returns a parsed representation of a glob string; does not require Minimatch.