Merge commit '5be51ac3db225d5df501ed1fa1499c41d97dbf65'

This commit is contained in:
Bjørn Erik Pedersen
2025-04-10 13:04:51 +02:00
987 changed files with 12379 additions and 14083 deletions

View File

@@ -1,2 +1,3 @@
export * from './bridgeTurboAndAlpine';
export * from './helpers';
export * from './lrucache';

View File

@@ -0,0 +1,19 @@
// A simple LRU cache implementation backed by a map.
export class LRUCache {
constructor(maxSize) {
this.maxSize = maxSize;
this.cache = new Map();
}
get(key) {
return this.cache.get(key);
}
put(key, value) {
if (this.cache.size >= this.maxSize) {
const firstKey = this.cache.keys().next().value;
this.cache.delete(firstKey);
}
this.cache.set(key, value);
}
}