Level / memdown

In-memory abstract-leveldown store for Node.js and browsers.
MIT License
287 stars 37 forks source link

Fix reverse iteration edge case #12

Closed mafintosh closed 10 years ago

mafintosh commented 10 years ago

Currently reverse iteration doesn't work when the reverse iteration starts at the first element in the db.

This PR fixes this by only resetting this._pos in the constructor if it hasn't been set before (before it was also reset when it was zero).

I've also added a simple test case to illustrate the issue.

rvagg commented 10 years ago

OK, I'll have to believe you on this one! I'll add you as a collaborator too. Do you want a patch release out of this.

mafintosh commented 10 years ago

Nice! A patch release would be great.

rvagg commented 10 years ago

@mafintosh done. Also, could you consider whether the new test case you've introduced could be put into toe abstract-leveldown suite instead so other implementations can take advantage of it?

mafintosh commented 10 years ago

It should definitely be in abstract-leveldown. Mostly added it here to not have too many concurrently PRs. I'll move it out.