chriso/lru — pull request #1 by dustyleary (2012-04-17 01:33:41+00:00)
Title: fix bugs, add "eviction event" feature

First, I apologize for a pile-o-code out of nowhere. It's not my intention to hijack your project.

I had meant to just add the 'evict' event, but I ran into a bug or two along the way, which I fixed, and added tests for... But, because I am easily confused, I changed the implementation a bit to add an explicit 'remove' method, which the other methods delegate to.

If you grab the lru-test.js and run it against the original library, you'll see that a number of the tests fail... Most importantly imo is that the LRU invariant is not kept when you call get() and the element being retrieved is in the head or tail position.