Skip to content

Commit 98bc892

Browse files
committed
[Fix] parse: optimize segment addition in splitKeyIntoSegments function
1 parent 40c54a8 commit 98bc892

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/parse.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ var splitKeyIntoSegments = function splitKeyIntoSegments(originalKey, options) {
270270

271271
if (close < 0) {
272272
// Unterminated group: wrap the raw remainder once as a single literal segment
273-
segments.push('[' + key.slice(open) + ']');
273+
segments[segments.length] = '[' + key.slice(open) + ']';
274274
return segments;
275275
}
276276

@@ -281,7 +281,7 @@ var splitKeyIntoSegments = function splitKeyIntoSegments(originalKey, options) {
281281
return;
282282
}
283283

284-
segments.push(seg);
284+
segments[segments.length] = seg;
285285
collected += 1;
286286

287287
// find the next '[' after this balanced group

0 commit comments

Comments
 (0)