项目原始demo,不改动
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
Dieses Repo ist archiviert. Du kannst Dateien sehen und es klonen, kannst aber nicht pushen oder Issues/Pull-Requests öffnen.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. # is-glob [![NPM version](https://img.shields.io/npm/v/is-glob.svg?style=flat)](https://www.npmjs.com/package/is-glob) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-glob.svg?style=flat)](https://npmjs.org/package/is-glob) [![NPM total downloads](https://img.shields.io/npm/dt/is-glob.svg?style=flat)](https://npmjs.org/package/is-glob) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-glob.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-glob) [![Windows Build Status](https://img.shields.io/appveyor/ci/jonschlinkert/is-glob.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/jonschlinkert/is-glob)
  2. > 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 better user experience.
  3. ## Install
  4. Install with [npm](https://www.npmjs.com/):
  5. ```sh
  6. $ npm install --save is-glob
  7. ```
  8. You might also be interested in [is-valid-glob](https://github.com/jonschlinkert/is-valid-glob) and [has-glob](https://github.com/jonschlinkert/has-glob).
  9. ## Usage
  10. ```js
  11. var isGlob = require('is-glob');
  12. ```
  13. ### Default behavior
  14. **True**
  15. Patterns that have glob characters or regex patterns will return `true`:
  16. ```js
  17. isGlob('!foo.js');
  18. isGlob('*.js');
  19. isGlob('**/abc.js');
  20. isGlob('abc/*.js');
  21. isGlob('abc/(aaa|bbb).js');
  22. isGlob('abc/[a-z].js');
  23. isGlob('abc/{a,b}.js');
  24. //=> true
  25. ```
  26. Extglobs
  27. ```js
  28. isGlob('abc/@(a).js');
  29. isGlob('abc/!(a).js');
  30. isGlob('abc/+(a).js');
  31. isGlob('abc/*(a).js');
  32. isGlob('abc/?(a).js');
  33. //=> true
  34. ```
  35. **False**
  36. Escaped globs or extglobs return `false`:
  37. ```js
  38. isGlob('abc/\\@(a).js');
  39. isGlob('abc/\\!(a).js');
  40. isGlob('abc/\\+(a).js');
  41. isGlob('abc/\\*(a).js');
  42. isGlob('abc/\\?(a).js');
  43. isGlob('\\!foo.js');
  44. isGlob('\\*.js');
  45. isGlob('\\*\\*/abc.js');
  46. isGlob('abc/\\*.js');
  47. isGlob('abc/\\(aaa|bbb).js');
  48. isGlob('abc/\\[a-z].js');
  49. isGlob('abc/\\{a,b}.js');
  50. //=> false
  51. ```
  52. Patterns that do not have glob patterns return `false`:
  53. ```js
  54. isGlob('abc.js');
  55. isGlob('abc/def/ghi.js');
  56. isGlob('foo.js');
  57. isGlob('abc/@.js');
  58. isGlob('abc/+.js');
  59. isGlob('abc/?.js');
  60. isGlob();
  61. isGlob(null);
  62. //=> false
  63. ```
  64. Arrays are also `false` (If you want to check if an array has a glob pattern, use [has-glob](https://github.com/jonschlinkert/has-glob)):
  65. ```js
  66. isGlob(['**/*.js']);
  67. isGlob(['foo.js']);
  68. //=> false
  69. ```
  70. ### Option strict
  71. When `options.strict === false` the behavior is less strict in determining if a pattern is a glob. Meaning that
  72. some patterns that would return `false` may return `true`. This is done so that matching libraries like [micromatch](https://github.com/micromatch/micromatch) have a chance at determining if the pattern is a glob or not.
  73. **True**
  74. Patterns that have glob characters or regex patterns will return `true`:
  75. ```js
  76. isGlob('!foo.js', {strict: false});
  77. isGlob('*.js', {strict: false});
  78. isGlob('**/abc.js', {strict: false});
  79. isGlob('abc/*.js', {strict: false});
  80. isGlob('abc/(aaa|bbb).js', {strict: false});
  81. isGlob('abc/[a-z].js', {strict: false});
  82. isGlob('abc/{a,b}.js', {strict: false});
  83. //=> true
  84. ```
  85. Extglobs
  86. ```js
  87. isGlob('abc/@(a).js', {strict: false});
  88. isGlob('abc/!(a).js', {strict: false});
  89. isGlob('abc/+(a).js', {strict: false});
  90. isGlob('abc/*(a).js', {strict: false});
  91. isGlob('abc/?(a).js', {strict: false});
  92. //=> true
  93. ```
  94. **False**
  95. Escaped globs or extglobs return `false`:
  96. ```js
  97. isGlob('\\!foo.js', {strict: false});
  98. isGlob('\\*.js', {strict: false});
  99. isGlob('\\*\\*/abc.js', {strict: false});
  100. isGlob('abc/\\*.js', {strict: false});
  101. isGlob('abc/\\(aaa|bbb).js', {strict: false});
  102. isGlob('abc/\\[a-z].js', {strict: false});
  103. isGlob('abc/\\{a,b}.js', {strict: false});
  104. //=> false
  105. ```
  106. ## About
  107. ### Related projects
  108. * [assemble](https://www.npmjs.com/package/assemble): Get the rocks out of your socks! Assemble makes you fast at creating web projects… [more](https://github.com/assemble/assemble) | [homepage](https://github.com/assemble/assemble "Get the rocks out of your socks! Assemble makes you fast at creating web projects. Assemble is used by thousands of projects for rapid prototyping, creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, building websit")
  109. * [base](https://www.npmjs.com/package/base): Framework for rapidly creating high quality node.js applications, using plugins like building blocks | [homepage](https://github.com/node-base/base "Framework for rapidly creating high quality node.js applications, using plugins like building blocks")
  110. * [update](https://www.npmjs.com/package/update): Be scalable! Update is a new, open source developer framework and CLI for automating updates… [more](https://github.com/update/update) | [homepage](https://github.com/update/update "Be scalable! Update is a new, open source developer framework and CLI for automating updates of any kind in code projects.")
  111. * [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://github.com/verbose/verb) | [homepage](https://github.com/verbose/verb "Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.")
  112. ### Contributing
  113. Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
  114. ### Contributors
  115. | **Commits** | **Contributor** |
  116. | --- | --- |
  117. | 47 | [jonschlinkert](https://github.com/jonschlinkert) |
  118. | 1 | [doowb](https://github.com/doowb) |
  119. | 1 | [tuvistavie](https://github.com/tuvistavie) |
  120. ### Building docs
  121. _(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
  122. To generate the readme, run the following command:
  123. ```sh
  124. $ npm install -g verbose/verb#dev verb-generate-readme && verb
  125. ```
  126. ### Running tests
  127. Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
  128. ```sh
  129. $ npm install && npm test
  130. ```
  131. ### Author
  132. **Jon Schlinkert**
  133. * [github/jonschlinkert](https://github.com/jonschlinkert)
  134. * [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
  135. ### License
  136. Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
  137. Released under the [MIT License](LICENSE).
  138. ***
  139. _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on August 07, 2017._