Skip to content

Commit db542fc

Browse files
Update cache.mjs
1 parent 968a8f4 commit db542fc

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/cache.mjs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,13 @@ export default class Cache {
243243

244244
// Iterator to iterate over cache with a 'for...of' loop
245245
*[Symbol.iterator]() {
246-
this.forEach(function (data) {
247-
yield data;
248-
});
246+
let node = this.#linkedList.head;
247+
while (node) {
248+
let next = node.next;
249+
if (this.has(node.value.key)) {
250+
yield { [node.value.key]: node.value.value };
251+
}
252+
node = next;
253+
}
249254
}
250255
}

0 commit comments

Comments
 (0)