Yomguithereal / mnemonist

Curated collection of data structures for the JavaScript/TypeScript language.
https://yomguithereal.github.io/mnemonist
MIT License
2.24k stars 92 forks source link

LRUCache/LRUMap family -- inspect and toString improvements #187

Open mrflip opened 1 year ago

mrflip commented 1 year ago

The current inspect will put the entire contents of its key/value set onto the screen, causing voluminous dump and/or hiding the end of the contents, and makes it harder to examine its internals. This makes all the LRU classes inherit the method properly; tastefully limits the output while showing both the head and tail; and has an all: true trap door to get a shallow copy of the cache as a POJO.