Allow nested arrays

This commit is contained in:
Jarred Sumner
2021-09-26 23:04:07 -07:00
parent b3894994c0
commit eb3473125c
2 changed files with 104 additions and 26 deletions

View File

@@ -1085,13 +1085,17 @@ pub const JSArrayIterator = struct {
len: u32 = 0,
array: JSValue,
global: *JSGlobalObject,
pub fn init(value: JSValue, global: *JSGlobalObject) JSArrayIterator {
return .{ .array = value, .global = global, .len = value.getLengthOfArray(global) };
return .{
.array = value,
.global = global,
.len = value.getLengthOfArray(global),
};
}
pub fn next(this: *JSArrayIterator) ?JSValue {
if (this.i >= this.len) {
if (!(this.i < this.len)) {
return null;
}
const i = this.i;