* Rewrite glob patterns according to .gitignore syntax relative to cwd. * https://git-scm.com/docs/gitignore#_pattern_format * @param {string} pattern In .gitignore format * @return {string} Pattern in standard glob format
(pattern)
| 17 | * @return {string} Pattern in standard glob format |
| 18 | */ |
| 19 | function gitignoreToGlobPattern(pattern) { |
| 20 | // If there is a separator at the beginning or middle (or both) of the |
| 21 | // pattern, then the pattern is relative to the directory level of the |
| 22 | // particular .gitignore file itself. |
| 23 | if (pattern.startsWith('/')) { |
| 24 | return pattern.substr(1); |
| 25 | } |
| 26 | // Otherwise the pattern may also match at any level below the .gitignore level. |
| 27 | return `**/${pattern}`; |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * @return {Promise<string[]>} |
no outgoing calls
no test coverage detected