blob: 2ecbe2a74ec48b05c261756e8813dd159a12bc87 [file] [log] [blame]
Leo Repp58b9f112021-11-22 11:57:47 +01001/*!
2 * is-glob <https://github.com/jonschlinkert/is-glob>
3 *
4 * Copyright (c) 2014-2016, Jon Schlinkert.
5 * Licensed under the MIT License.
6 */
7
8var isExtglob = require('is-extglob');
9
10module.exports = function isGlob(str) {
11 if (typeof str !== 'string' || str === '') {
12 return false;
13 }
14
15 if (isExtglob(str)) return true;
16
17 var regex = /(\\).|([*?]|\[.*\]|\{.*\}|\(.*\|.*\)|^!)/;
18 var match;
19
20 while ((match = regex.exec(str))) {
21 if (match[2]) return true;
22 str = str.slice(match.index + match[0].length);
23 }
24 return false;
25};