cdk8s-plus-33 2.5.2 → 2.5.3

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.
@@ -61,10 +61,13 @@ function parseCommaParts(str) {
61
61
  return parts;
62
62
  }
63
63
 
64
- function expandTop(str) {
64
+ function expandTop(str, options) {
65
65
  if (!str)
66
66
  return [];
67
67
 
68
+ options = options || {};
69
+ var max = options.max == null ? Infinity : options.max;
70
+
68
71
  // I don't know why Bash 4.3 does this, but it does.
69
72
  // Anything starting with {} will have the first two bytes preserved
70
73
  // but *only* at the top level, so {},a}b will not expand to anything,
@@ -75,7 +78,7 @@ function expandTop(str) {
75
78
  str = '\\{\\}' + str.substr(2);
76
79
  }
77
80
 
78
- return expand(escapeBraces(str), true).map(unescapeBraces);
81
+ return expand(escapeBraces(str), max, true).map(unescapeBraces);
79
82
  }
80
83
 
81
84
  function embrace(str) {
@@ -92,7 +95,7 @@ function gte(i, y) {
92
95
  return i >= y;
93
96
  }
94
97
 
95
- function expand(str, isTop) {
98
+ function expand(str, max, isTop) {
96
99
  var expansions = [];
97
100
 
98
101
  var m = balanced('{', '}', str);
@@ -101,11 +104,11 @@ function expand(str, isTop) {
101
104
  // no need to expand pre, since it is guaranteed to be free of brace-sets
102
105
  var pre = m.pre;
103
106
  var post = m.post.length
104
- ? expand(m.post, false)
107
+ ? expand(m.post, max, false)
105
108
  : [''];
106
109
 
107
110
  if (/\$$/.test(m.pre)) {
108
- for (var k = 0; k < post.length; k++) {
111
+ for (var k = 0; k < post.length && k < max; k++) {
109
112
  var expansion = pre+ '{' + m.body + '}' + post[k];
110
113
  expansions.push(expansion);
111
114
  }
@@ -118,7 +121,7 @@ function expand(str, isTop) {
118
121
  // {a},b}
119
122
  if (m.post.match(/,(?!,).*\}/)) {
120
123
  str = m.pre + '{' + m.body + escClose + m.post;
121
- return expand(str);
124
+ return expand(str, max, true);
122
125
  }
123
126
  return [str];
124
127
  }
@@ -130,7 +133,7 @@ function expand(str, isTop) {
130
133
  n = parseCommaParts(m.body);
131
134
  if (n.length === 1) {
132
135
  // x{{a,b}}y ==> x{a}y x{b}y
133
- n = expand(n[0], false).map(embrace);
136
+ n = expand(n[0], max, false).map(embrace);
134
137
  if (n.length === 1) {
135
138
  return post.map(function(p) {
136
139
  return m.pre + n[0] + p;
@@ -185,12 +188,12 @@ function expand(str, isTop) {
185
188
  N = [];
186
189
 
187
190
  for (var j = 0; j < n.length; j++) {
188
- N.push.apply(N, expand(n[j], false));
191
+ N.push.apply(N, expand(n[j], max, false));
189
192
  }
190
193
  }
191
194
 
192
195
  for (var j = 0; j < N.length; j++) {
193
- for (var k = 0; k < post.length; k++) {
196
+ for (var k = 0; k < post.length && expansions.length < max; k++) {
194
197
  var expansion = pre + N[j] + post[k];
195
198
  if (!isTop || isSequence || expansion)
196
199
  expansions.push(expansion);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "brace-expansion",
3
3
  "description": "Brace expansion as known from sh/bash",
4
- "version": "2.0.3",
4
+ "version": "2.1.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git://github.com/juliangruber/brace-expansion.git"
package/package.json CHANGED
@@ -103,7 +103,7 @@
103
103
  "publishConfig": {
104
104
  "access": "public"
105
105
  },
106
- "version": "2.5.2",
106
+ "version": "2.5.3",
107
107
  "jest": {
108
108
  "coverageProvider": "v8",
109
109
  "testMatch": [