parse-glob NPM version Build Status

Parse a glob pattern into an object of tokens.

Changes from v1.0.0 to v3.0.4

See the properties section for details.

Install with npm

$ npm i parse-glob --save

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:

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 © 2014-2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on September 22, 2015.