2022-01-21 08:28:41 +00:00
|
|
|
/*!
|
|
|
|
* is-glob <https://github.com/jonschlinkert/is-glob>
|
|
|
|
*
|
2022-04-08 10:55:35 +00:00
|
|
|
* Copyright (c) 2014-2016, Jon Schlinkert.
|
|
|
|
* Licensed under the MIT License.
|
2022-01-21 08:28:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
var isExtglob = require('is-extglob');
|
|
|
|
|
2022-04-08 10:55:35 +00:00
|
|
|
module.exports = function isGlob(str) {
|
2022-01-21 08:28:41 +00:00
|
|
|
if (typeof str !== 'string' || str === '') {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2022-04-08 10:55:35 +00:00
|
|
|
if (isExtglob(str)) return true;
|
2022-01-21 08:28:41 +00:00
|
|
|
|
2022-04-08 10:55:35 +00:00
|
|
|
var regex = /(\\).|([*?]|\[.*\]|\{.*\}|\(.*\|.*\)|^!)/;
|
|
|
|
var match;
|
2022-01-21 08:28:41 +00:00
|
|
|
|
2022-04-08 10:55:35 +00:00
|
|
|
while ((match = regex.exec(str))) {
|
|
|
|
if (match[2]) return true;
|
|
|
|
str = str.slice(match.index + match[0].length);
|
2022-01-21 08:28:41 +00:00
|
|
|
}
|
2022-04-08 10:55:35 +00:00
|
|
|
return false;
|
2022-01-21 08:28:41 +00:00
|
|
|
};
|