summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js')
-rw-r--r--deps/npm/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/deps/npm/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js b/deps/npm/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js
index abe535df32..955f27c817 100644
--- a/deps/npm/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js
+++ b/deps/npm/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js
@@ -66,6 +66,16 @@ function expandTop(str) {
if (!str)
return [];
+ // I don't know why Bash 4.3 does this, but it does.
+ // Anything starting with {} will have the first two bytes preserved
+ // but *only* at the top level, so {},a}b will not expand to anything,
+ // but a{},b}c will be expanded to [a}c,abc].
+ // One could argue that this is a bug in Bash, but since the goal of
+ // this module is to match Bash's rules, we escape a leading {}
+ if (str.substr(0, 2) === '{}') {
+ str = '\\{\\}' + str.substr(2);
+ }
+
return expand(escapeBraces(str), true).map(unescapeBraces);
}
@@ -188,3 +198,4 @@ function expand(str, isTop) {
return expansions;
}
+