wallet-core/node_modules/glob-parent
2016-11-03 01:33:53 +01:00
..
node_modules node_modules 2016-11-03 01:33:53 +01:00
.npmignore add node_modules to address #4364 2016-10-10 03:43:44 +02:00
.travis.yml node_modules 2016-11-03 01:33:53 +01:00
appveyor.yml node_modules 2016-11-03 01:33:53 +01:00
index.js node_modules 2016-11-03 01:33:53 +01:00
LICENSE add node_modules to address #4364 2016-10-10 03:43:44 +02:00
package.json node_modules 2016-11-03 01:33:53 +01:00
README.md node_modules 2016-11-03 01:33:53 +01:00
test.js node_modules 2016-11-03 01:33:53 +01:00

glob-parent Build Status Coverage Status

Javascript module to extract the non-magic parent path from a glob string.

NPM NPM

Usage

npm install glob-parent --save

Examples

var globParent = require('glob-parent');

globParent('path/to/*.js'); // 'path/to'
globParent('/root/path/to/*.js'); // '/root/path/to'
globParent('/*.js'); // '/'
globParent('*.js'); // '.'
globParent('**/*.js'); // '.'
globParent('path/{to,from}'); // 'path'
globParent('path/!(to|from)'); // 'path'
globParent('path/?(to|from)'); // 'path'
globParent('path/+(to|from)'); // 'path'
globParent('path/*(to|from)'); // 'path'
globParent('path/@(to|from)'); // 'path'
globParent('path/**/*'); // 'path'

// if provided a non-glob path, returns the nearest dir
globParent('path/foo/bar.js'); // 'path/foo'
globParent('path/foo/'); // 'path/foo'
globParent('path/foo'); // 'path' (see issue #3 for details)

Escaping

The following characters have special significance in glob patterns and must be escaped if you want them to be treated as regular path characters:

  • ? (question mark)
  • * (star)
  • | (pipe)
  • ( (opening parenthesis)
  • ) (closing parenthesis)
  • { (opening curly brace)
  • } (closing curly brace)
  • [ (opening bracket)
  • ] (closing bracket)

Example

globParent('foo/[bar]/') // 'foo'
globParent('foo/\\[bar]/') // 'foo/[bar]'

Change Log

See release notes page on GitHub

License

ISC