| Leo Repp | 58b9f11 | 2021-11-22 11:57:47 +0100 | [diff] [blame^] | 1 | /*! |
| 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 | |
| 8 | var isExtglob = require('is-extglob'); |
| 9 | |
| 10 | module.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 | }; |