Skip to content

Commit

Permalink
iterable and iterator protocol tested with quickjs repl
Browse files Browse the repository at this point in the history
  • Loading branch information
ailisp committed May 20, 2022
1 parent 366c75e commit a556854
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/collections/vector.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,13 @@ export class Vector {
}
}

iter() {
[Symbol.iterator]() {
return new VectorIterator(this)
}

toArray() {
let ret = []
let iterator = this.iter()
for (let v of iterator) {
for (let v of this) {
ret.push(v)
}
return ret
Expand Down

0 comments on commit a556854

Please sign in to comment.