npm quick-lru 8.0.0

one hour ago

Breaking

  • Require Node.js 22 378efc2
  • Make .keys(), .values(), and the iterator (for…of, spread) go from the oldest item to the newest, like .entries() and .forEach() 378efc2
    • Before, they started with the most recent batch of items and then went to the older batch, so the order was neither oldest first nor newest first.
  • Throw a TypeError for an invalid maxSize, also in .resize() 378efc2
    • It must be a whole number greater than 0, or Infinity. Before, a fraction like 1.5 or a string like '10' was accepted.
  • Throw a TypeError for a negative or NaN maxAge 378efc2
    • Before, only 0 threw. A negative value was accepted, and NaN silently meant no expiration.
  • Call onEviction after the item is removed, not right before 378efc2

Improvements

Fixes

  • Fix onEviction being called for an item that was overwritten with .set() and is still in the cache 378efc2
  • Fix .evict() letting the cache grow without limit when it is called repeatedly between writes 378efc2
  • Fix infinite recursion when onEviction reads an expired item 378efc2
  • Fix iteration skipping items, or visiting items added during the loop, when the cache changes during iteration 378efc2
  • Fix the TypeScript types with TypeScript 5.6 and later 378efc2
    • QuickLRU was not assignable to Map, and iterator helpers like .keys().map() were missing.

v7.3.0...v8.0.0

Don't miss a new quick-lru release

NewReleases is sending notifications on new releases.