Gathering detailed insights and metrics for is-glob
Gathering detailed insights and metrics for is-glob
Gathering detailed insights and metrics for is-glob
Gathering detailed insights and metrics for is-glob
If you use globs, this will make your code faster. 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. 55+ million downloads.
npm install is-glob
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
91 Stars
68 Commits
9 Forks
6 Watching
2 Branches
9 Contributors
Updated on 18 Sept 2024
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-7.9%
12,644,102
Compared to previous day
Last week
1.6%
75,981,205
Compared to previous week
Last month
17.4%
306,400,465
Compared to previous month
Last year
0.2%
3,066,982,510
Compared to previous year
1
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.
Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your :heart: and support.
Install with npm:
1$ npm install --save is-glob
You might also be interested in is-valid-glob and has-glob.
1var isGlob = require('is-glob');
True
Patterns that have glob characters or regex patterns will return true
:
1isGlob('!foo.js'); 2isGlob('*.js'); 3isGlob('**/abc.js'); 4isGlob('abc/*.js'); 5isGlob('abc/(aaa|bbb).js'); 6isGlob('abc/[a-z].js'); 7isGlob('abc/{a,b}.js'); 8//=> true
Extglobs
1isGlob('abc/@(a).js'); 2isGlob('abc/!(a).js'); 3isGlob('abc/+(a).js'); 4isGlob('abc/*(a).js'); 5isGlob('abc/?(a).js'); 6//=> true
False
Escaped globs or extglobs return false
:
1isGlob('abc/\\@(a).js'); 2isGlob('abc/\\!(a).js'); 3isGlob('abc/\\+(a).js'); 4isGlob('abc/\\*(a).js'); 5isGlob('abc/\\?(a).js'); 6isGlob('\\!foo.js'); 7isGlob('\\*.js'); 8isGlob('\\*\\*/abc.js'); 9isGlob('abc/\\*.js'); 10isGlob('abc/\\(aaa|bbb).js'); 11isGlob('abc/\\[a-z].js'); 12isGlob('abc/\\{a,b}.js'); 13//=> false
Patterns that do not have glob patterns return false
:
1isGlob('abc.js'); 2isGlob('abc/def/ghi.js'); 3isGlob('foo.js'); 4isGlob('abc/@.js'); 5isGlob('abc/+.js'); 6isGlob('abc/?.js'); 7isGlob(); 8isGlob(null); 9//=> false
Arrays are also false
(If you want to check if an array has a glob pattern, use has-glob):
1isGlob(['**/*.js']); 2isGlob(['foo.js']); 3//=> false
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
:
1isGlob('!foo.js', {strict: false});
2isGlob('*.js', {strict: false});
3isGlob('**/abc.js', {strict: false});
4isGlob('abc/*.js', {strict: false});
5isGlob('abc/(aaa|bbb).js', {strict: false});
6isGlob('abc/[a-z].js', {strict: false});
7isGlob('abc/{a,b}.js', {strict: false});
8//=> true
Extglobs
1isGlob('abc/@(a).js', {strict: false}); 2isGlob('abc/!(a).js', {strict: false}); 3isGlob('abc/+(a).js', {strict: false}); 4isGlob('abc/*(a).js', {strict: false}); 5isGlob('abc/?(a).js', {strict: false}); 6//=> true
False
Escaped globs or extglobs return false
:
1isGlob('\\!foo.js', {strict: false});
2isGlob('\\*.js', {strict: false});
3isGlob('\\*\\*/abc.js', {strict: false});
4isGlob('abc/\\*.js', {strict: false});
5isGlob('abc/\\(aaa|bbb).js', {strict: false});
6isGlob('abc/\\[a-z].js', {strict: false});
7isGlob('abc/\\{a,b}.js', {strict: false});
8//=> false
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
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:
1$ npm install && npm test
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
1$ npm install -g verbose/verb#dev verb-generate-readme && verb
You might also be interested in these projects:
Commits | Contributor |
---|---|
47 | jonschlinkert |
5 | doowb |
1 | phated |
1 | danhper |
1 | paulmillr |
Jon Schlinkert
Copyright © 2019, Jon Schlinkert. Released under the MIT License.
This file was generated by verb-generate-readme, v0.8.0, on March 27, 2019.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
security policy file detected
Details
Reason
Found 3/26 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More