is-glob
Returns
trueif 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.
Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your ❤️ and support.
Install
Install with npm:
$ npm install --save is-globYou might also be interested in is-valid-glob and has-glob.
Usage
var isGlob = require('is-glob');Default behavior
True
Patterns that have glob characters or regex patterns will return true:
isGlob('!foo.js');
isGlob('*.js');
isGlob('**/abc.js');
isGlob('abc/*.js');
isGlob('abc/(aaa|bbb).js');
isGlob('abc/[a-z].js');
isGlob('abc/{a,b}.js');
//=> trueExtglobs
False
Escaped globs or extglobs return false:
Patterns that do not have glob patterns return false:
Arrays are also false (If you want to check if an array has a glob pattern, use has-glob):
Option strict
When options.strict === false the behavior is less strict in determining if a pattern is a glob. Meaning that some patterns that would return false may return true. This is done so that matching libraries like micromatch have a chance at determining if the pattern is a glob or not.
True
Patterns that have glob characters or regex patterns will return true:
Extglobs
False
Escaped globs or extglobs return false:
About
Related projects
You might also be interested in these projects:
Contributors
Author
Jon Schlinkert
License
Copyright © 2019, Jon Schlinkert. Released under the MIT License.
This file was generated by verb-generate-readme, v0.8.0, on March 27, 2019.
Last updated
Was this helpful?