snyk 1.1304.0 → 1.1304.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -225913,10 +225913,13 @@ function parseCommaParts(str) {
225913
225913
  return parts;
225914
225914
  }
225915
225915
 
225916
- function expandTop(str) {
225916
+ function expandTop(str, options) {
225917
225917
  if (!str)
225918
225918
  return [];
225919
225919
 
225920
+ options = options || {};
225921
+ var max = options.max == null ? Infinity : options.max;
225922
+
225920
225923
  // I don't know why Bash 4.3 does this, but it does.
225921
225924
  // Anything starting with {} will have the first two bytes preserved
225922
225925
  // but *only* at the top level, so {},a}b will not expand to anything,
@@ -225927,7 +225930,7 @@ function expandTop(str) {
225927
225930
  str = '\\{\\}' + str.substr(2);
225928
225931
  }
225929
225932
 
225930
- return expand(escapeBraces(str), true).map(unescapeBraces);
225933
+ return expand(escapeBraces(str), max, true).map(unescapeBraces);
225931
225934
  }
225932
225935
 
225933
225936
  function embrace(str) {
@@ -225944,7 +225947,7 @@ function gte(i, y) {
225944
225947
  return i >= y;
225945
225948
  }
225946
225949
 
225947
- function expand(str, isTop) {
225950
+ function expand(str, max, isTop) {
225948
225951
  var expansions = [];
225949
225952
 
225950
225953
  var m = balanced('{', '}', str);
@@ -225953,11 +225956,11 @@ function expand(str, isTop) {
225953
225956
  // no need to expand pre, since it is guaranteed to be free of brace-sets
225954
225957
  var pre = m.pre;
225955
225958
  var post = m.post.length
225956
- ? expand(m.post, false)
225959
+ ? expand(m.post, max, false)
225957
225960
  : [''];
225958
225961
 
225959
225962
  if (/\$$/.test(m.pre)) {
225960
- for (var k = 0; k < post.length; k++) {
225963
+ for (var k = 0; k < post.length && k < max; k++) {
225961
225964
  var expansion = pre+ '{' + m.body + '}' + post[k];
225962
225965
  expansions.push(expansion);
225963
225966
  }
@@ -225970,7 +225973,7 @@ function expand(str, isTop) {
225970
225973
  // {a},b}
225971
225974
  if (m.post.match(/,(?!,).*\}/)) {
225972
225975
  str = m.pre + '{' + m.body + escClose + m.post;
225973
- return expand(str);
225976
+ return expand(str, max, true);
225974
225977
  }
225975
225978
  return [str];
225976
225979
  }
@@ -225982,7 +225985,7 @@ function expand(str, isTop) {
225982
225985
  n = parseCommaParts(m.body);
225983
225986
  if (n.length === 1) {
225984
225987
  // x{{a,b}}y ==> x{a}y x{b}y
225985
- n = expand(n[0], false).map(embrace);
225988
+ n = expand(n[0], max, false).map(embrace);
225986
225989
  if (n.length === 1) {
225987
225990
  return post.map(function(p) {
225988
225991
  return m.pre + n[0] + p;
@@ -226037,12 +226040,12 @@ function expand(str, isTop) {
226037
226040
  N = [];
226038
226041
 
226039
226042
  for (var j = 0; j < n.length; j++) {
226040
- N.push.apply(N, expand(n[j], false));
226043
+ N.push.apply(N, expand(n[j], max, false));
226041
226044
  }
226042
226045
  }
226043
226046
 
226044
226047
  for (var j = 0; j < N.length; j++) {
226045
- for (var k = 0; k < post.length; k++) {
226048
+ for (var k = 0; k < post.length && expansions.length < max; k++) {
226046
226049
  var expansion = pre + N[j] + post[k];
226047
226050
  if (!isTop || isSequence || expansion)
226048
226051
  expansions.push(expansion);