fixes npm audit errors in parse-glob
This repository has been archived on 2021-12-11. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
2015-03-08 22:00:41 -04:00
.editorconfig run update 2015-03-04 16:45:28 -05:00
.gitattributes run update 2015-03-04 16:45:28 -05:00
.gitignore run update 2015-03-04 16:45:28 -05:00
.jshintrc run update 2015-03-04 16:45:28 -05:00
.travis.yml run update 2015-03-04 16:45:28 -05:00
.verb.md update/rebuild docs 2015-03-08 22:00:41 -04:00
browser.js update tests for changes 2015-03-08 22:00:27 -04:00
index.js refactor 2015-03-08 21:53:00 -04:00
LICENSE run update 2015-03-04 16:45:28 -05:00
package.json 2.1.1 2015-03-06 15:38:31 -05:00
README.md update/rebuild docs 2015-03-08 22:00:41 -04:00
test.js update tests for changes 2015-03-08 22:00:27 -04:00

parse-glob NPM version Build Status

Parse a glob pattern into an object of tokens.

Changes from v1.0.0 to v3.0.0

  • 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

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

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}' } }

Properties

The object returned by parseGlob has the following properties:

  • orig: a copy of the original, unmodified glob pattern
  • is: an object with boolean information about the glob:
    • glob: true if the pattern actually a glob pattern
    • negated: 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 dotfiles
    • dotdir: true if the pattern should match dot-directories (like .git)
  • glob: the glob pattern part of the string, if any
  • base: the non-glob part of the string, if any
  • path: file path segments
    • dirname: directory
    • basename: file name with extension
    • filename: file name without extension
    • extname: file extension with dot
    • ext: file extension without dot
  • glob-base: Returns an object with the (non-glob) base path and the actual pattern.
  • glob-parent: Strips glob magic from a string to provide the parent path
  • is-glob: Returns true if the given string looks like a glob pattern.
  • glob-path-regex: Regular expression for matching the parts of glob pattern.
  • micromatch: Glob matching for javascript/node.js. A faster alternative to minimatch (10-45x faster on avg), with all the features you're used to using in your Grunt and gulp tasks.

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Tests

Install dev dependencies.

npm i -d && npm test

Author

Jon Schlinkert

License

Copyright (c) 2014-2015 Jon Schlinkert
Released under the MIT license


This file was generated by verb-cli on March 08, 2015.