Skip to content

Commit

Permalink
feat: support passing thisArg to forEach
Browse files Browse the repository at this point in the history
  • Loading branch information
Huy-DNA committed Sep 16, 2024
1 parent 202a8b1 commit 42ac6fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ export class Catche<K, V extends object> {
}());
}

forEach (fn: (value: V, key: K, map: Catche<K, V>) => void) {
forEach (fn: (value: V, key: K, map: Catche<K, V>) => void, thisArg?: unknown) {
this.#map.forEach((value, key) => {
const _value = value.deref();
if (_value) {
fn(_value, key, this);
}
})
}, thisArg);
}

size (): number {
Expand Down

0 comments on commit 42ac6fe

Please sign in to comment.