
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
parse-glob
Advanced tools
Parse a glob pattern into an object of tokens.
Changes from v1.0.0 to v3.0.4
path
objectis
objectbase
propertySee the properties section for details.
Install with npm
$ npm i parse-glob --save
See the tests for hundreds of examples.
var parseGlob = require('parse-glob');
Example
parseGlob('a/b/c/**/*.{yml,json}');
Returns:
{ orig: 'a/b/c/**/*.{yml,json}',
is:
{ glob: true,
negated: false,
extglob: false,
braces: true,
brackets: false,
globstar: true,
dotfile: false,
dotdir: false },
glob: '**/*.{yml,json}',
base: 'a/b/c',
path:
{ dirname: 'a/b/c/**/',
basename: '*.{yml,json}',
filename: '*',
extname: '.{yml,json}',
ext: '{yml,json}' } }
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 segments
dirname
: directorybasename
: file name with extensionfilename
: file name without extensionextname
: file extension with dotext
: file extension without dottrue
if the given string looks like a glob pattern. | homepagePull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Install dev dependencies:
$ npm i -d && npm test
Jon Schlinkert
Copyright © 2014-2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on September 22, 2015.
FAQs
Parse a glob pattern into an object of tokens.
The npm package parse-glob receives a total of 1,804,175 weekly downloads. As such, parse-glob popularity was classified as popular.
We found that parse-glob demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.