diff options
Diffstat (limited to 'node_modules/micromatch/index.js')
| -rw-r--r-- | node_modules/micromatch/index.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/node_modules/micromatch/index.js b/node_modules/micromatch/index.js index 1fad7f72..cb9d9ef3 100644 --- a/node_modules/micromatch/index.js +++ b/node_modules/micromatch/index.js @@ -4,7 +4,12 @@ const util = require('util'); const braces = require('braces'); const picomatch = require('picomatch'); const utils = require('picomatch/lib/utils'); -const isEmptyString = val => val === '' || val === './'; + +const isEmptyString = v => v === '' || v === './'; +const hasBraces = v => { + const index = v.indexOf('{'); + return index > -1 && v.indexOf('}', index) > -1; +}; /** * Returns an array of strings that match one or more glob patterns. @@ -445,7 +450,7 @@ micromatch.parse = (patterns, options) => { micromatch.braces = (pattern, options) => { if (typeof pattern !== 'string') throw new TypeError('Expected a string'); - if ((options && options.nobrace === true) || !/\{.*\}/.test(pattern)) { + if ((options && options.nobrace === true) || !hasBraces(pattern)) { return [pattern]; } return braces(pattern, options); @@ -464,4 +469,6 @@ micromatch.braceExpand = (pattern, options) => { * Expose micromatch */ +// exposed for tests +micromatch.hasBraces = hasBraces; module.exports = micromatch; |
