71de9d0d83c35840242e312c56c0677dec15644ba32c24235a77e27d89b0cfa17f114d485da7edaa289a401868165fc2fca3844e2954a30c49a76375359f22 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. glob-parent [![Build Status](https://travis-ci.org/es128/glob-parent.svg)](https://travis-ci.org/es128/glob-parent) [![Coverage Status](https://img.shields.io/coveralls/es128/glob-parent.svg)](https://coveralls.io/r/es128/glob-parent?branch=master)
  2. ======
  3. Javascript module to extract the non-magic parent path from a glob string.
  4. [![NPM](https://nodei.co/npm/glob-parent.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/glob-parent/)
  5. [![NPM](https://nodei.co/npm-dl/glob-parent.png?height=3&months=9)](https://nodei.co/npm-dl/glob-parent/)
  6. Usage
  7. -----
  8. ```sh
  9. npm install glob-parent --save
  10. ```
  11. ```js
  12. var globParent = require('glob-parent');
  13. globParent('path/to/*.js'); // 'path/to'
  14. globParent('/root/path/to/*.js'); // '/root/path/to'
  15. globParent('/*.js'); // '/'
  16. globParent('*.js'); // '.'
  17. globParent('**/*.js'); // '.'
  18. globParent('path/{to,from}'); // 'path'
  19. globParent('path/!(to|from)'); // 'path'
  20. globParent('path/?(to|from)'); // 'path'
  21. globParent('path/+(to|from)'); // 'path'
  22. globParent('path/*(to|from)'); // 'path'
  23. globParent('path/@(to|from)'); // 'path'
  24. globParent('path/**/*'); // 'path'
  25. // if provided a non-glob path, returns the nearest dir
  26. globParent('path/foo/bar.js'); // 'path/foo'
  27. globParent('path/foo/'); // 'path/foo'
  28. globParent('path/foo'); // 'path' (see issue #3 for details)
  29. ```
  30. Change Log
  31. ----------
  32. [See release notes page on GitHub](https://github.com/es128/glob-parent/releases)
  33. License
  34. -------
  35. [ISC](https://raw.github.com/es128/glob-parent/master/LICENSE)