|
11 months ago | |
---|---|---|
.. | ||
LICENSE | 11 months ago | |
README.md | 11 months ago | |
index.js | 11 months ago | |
package.json | 11 months ago |
Return true if a value is a valid glob pattern or patterns.
This really just checks to make sure that a pattern is either a string or array, and if it's an array it's either empty or consists of only strings.
Install with npm
$ npm i is-valid-glob --save
var isValidGlob = require('is-valid-glob');
isValidGlob('foo/*.js');
//=> true
Valid patterns
isValidGlob('a');
isValidGlob('a.js');
isValidGlob('*.js');
isValidGlob(['a', 'b']);
//=> all true
Invalid patterns
isValidGlob();
isValidGlob('');
isValidGlob(null);
isValidGlob(undefined);
isValidGlob(new Buffer('foo'));
isValidGlob(['foo', [[]]]);
isValidGlob(['foo', [['bar']]]);
isValidGlob(['foo', {}]);
isValidGlob({});
isValidGlob([]);
isValidGlob(['']);
//=> all false
true
if the given string looks like a glob pattern.Install dev dependencies:
$ npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Jon Schlinkert
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on July 11, 2015.