githubEdit

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 better user experience.

Please consider following this project's author, Jon Schlinkertarrow-up-right, and consider starring the project to show your ❤️ and support.

Install

Install with npmarrow-up-right:

$ npm install --save is-glob

You might also be interested in is-valid-globarrow-up-right and has-globarrow-up-right.

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');
//=> true

Extglobs

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-globarrow-up-right):

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 micromatcharrow-up-right 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

chevron-rightContributinghashtag

Pull requests and stars are always welcome. For bugs and feature requests, please create an issuearrow-up-right.

chevron-rightRunning Testshashtag

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:

chevron-rightBuilding docshashtag

(This project's readme.md is generated by verbarrow-up-right, please don't edit the readme directly. Any changes to the readme must be made in the .verb.mdarrow-up-right readme template.)

To generate the readme, run the following command:

You might also be interested in these projects:

Contributors

Author

Jon Schlinkert

License

Copyright © 2019, Jon Schlinkertarrow-up-right. Released under the MIT Licensearrow-up-right.


This file was generated by verb-generate-readmearrow-up-right, v0.8.0, on March 27, 2019.

Last updated