Skip to content

Commit 1c5d775

Browse files
committed
fix: rename caches to commonCaches
Renames the `caches` variable because it interferes with the global browser API. Fixes benjamn#492
1 parent 83f0f72 commit 1c5d775

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export interface OptionsWithCacheInstance<
131131
cache: CommonCache<NoInfer<TCacheKey>, Entry<NoInfer<TArgs>, NoInfer<TResult>>>;
132132
};
133133

134-
const caches = new Set<CommonCache<any, AnyEntry>>();
134+
const commonCaches = new Set<CommonCache<any, AnyEntry>>();
135135

136136
export function wrap<
137137
TArgs extends any[],
@@ -179,14 +179,14 @@ export function wrap<
179179
// since we just finished computing its value.
180180
cache.set(key, entry);
181181

182-
caches.add(cache);
182+
commonCaches.add(cache);
183183

184184
// Clean up any excess entries in the cache, but only if there is no
185185
// active parent entry, meaning we're not in the middle of a larger
186186
// computation that might be flummoxed by the cleaning.
187187
if (! parentEntrySlot.hasValue()) {
188-
caches.forEach(cache => cache.clean());
189-
caches.clear();
188+
commonCaches.forEach(cache => cache.clean());
189+
commonCaches.clear();
190190
}
191191

192192
return value;

0 commit comments

Comments
 (0)