Skip to content

Commit 1b244fa

Browse files
committed
Found small bug when the value 0 is passed (treated as false and discarded)
1 parent 36f1e3c commit 1b244fa

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ export const BaseParser = (class {
189189
if(this.tryRun(new RegExp(`${this.ESC}`, 'ys'))){
190190
let value = this.values[this.valueIndex++];
191191
for(value of Array.isArray(value)?value:[value]){
192-
if(value) this.children.push(['@injected', null, [value]]);
192+
if(value||value===0) this.children.push(['@injected', null, [value]]);
193193
}
194194
continue;
195195
}

src/utils.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,8 @@ function update_property_handler(object, property, create_handler) {
385385
export const Queue = class {
386386

387387
constructor(arr) {
388-
this.data = [...(arr || [])];
389-
this.lr = [0, this.data.length];
388+
this.data = [...(arr || []), null];
389+
this.lr = [0, (arr?arr.length:0)];
390390
}
391391
get capacity() {
392392
return this.data.length;
@@ -413,7 +413,7 @@ export const Queue = class {
413413
};
414414
resize(newLength) {
415415
if (newLength === undefined) {
416-
if (this.length + 1 >= this.capacity)
416+
if (this.length + 2 >= this.capacity)
417417
return this.resize(1 + 3 * this.length);
418418
if (this.length <= this.capacity >> 2)
419419
return this.resize(this.capacity >> 1);

0 commit comments

Comments
 (0)