You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.4 KiB

4 years ago
  1. # is-extglob [![NPM version](https://img.shields.io/npm/v/is-extglob.svg?style=flat)](https://www.npmjs.com/package/is-extglob) [![NPM downloads](https://img.shields.io/npm/dm/is-extglob.svg?style=flat)](https://npmjs.org/package/is-extglob) [![Build Status](https://img.shields.io/travis/jonschlinkert/is-extglob.svg?style=flat)](https://travis-ci.org/jonschlinkert/is-extglob)
  2. > Returns true if a string has an extglob.
  3. ## Install
  4. Install with [npm](https://www.npmjs.com/):
  5. ```sh
  6. $ npm install --save is-extglob
  7. ```
  8. ## Usage
  9. ```js
  10. var isExtglob = require('is-extglob');
  11. ```
  12. **True**
  13. ```js
  14. isExtglob('?(abc)');
  15. isExtglob('@(abc)');
  16. isExtglob('!(abc)');
  17. isExtglob('*(abc)');
  18. isExtglob('+(abc)');
  19. ```
  20. **False**
  21. Escaped extglobs:
  22. ```js
  23. isExtglob('\\?(abc)');
  24. isExtglob('\\@(abc)');
  25. isExtglob('\\!(abc)');
  26. isExtglob('\\*(abc)');
  27. isExtglob('\\+(abc)');
  28. ```
  29. Everything else...
  30. ```js
  31. isExtglob('foo.js');
  32. isExtglob('!foo.js');
  33. isExtglob('*.js');
  34. isExtglob('**/abc.js');
  35. isExtglob('abc/*.js');
  36. isExtglob('abc/(aaa|bbb).js');
  37. isExtglob('abc/[a-z].js');
  38. isExtglob('abc/{a,b}.js');
  39. isExtglob('abc/?.js');
  40. isExtglob('abc.js');
  41. isExtglob('abc/def/ghi.js');
  42. ```
  43. ## History
  44. **v2.0**
  45. Adds support for escaping. Escaped exglobs no longer return true.
  46. ## About
  47. ### Related projects
  48. * [has-glob](https://www.npmjs.com/package/has-glob): Returns `true` if an array has a glob pattern. | [homepage](https://github.com/jonschlinkert/has-glob "Returns `true` if an array has a glob pattern.")
  49. * [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet")
  50. * [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/jonschlinkert/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.")
  51. ### Contributing
  52. Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
  53. ### Building docs
  54. _(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_
  55. To generate the readme and API documentation with [verb](https://github.com/verbose/verb):
  56. ```sh
  57. $ npm install -g verb verb-generate-readme && verb
  58. ```
  59. ### Running tests
  60. Install dev dependencies:
  61. ```sh
  62. $ npm install -d && npm test
  63. ```
  64. ### Author
  65. **Jon Schlinkert**
  66. * [github/jonschlinkert](https://github.com/jonschlinkert)
  67. * [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
  68. ### License
  69. Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
  70. Released under the [MIT license](https://github.com/jonschlinkert/is-extglob/blob/master/LICENSE).
  71. ***
  72. _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.31, on October 12, 2016._