refactor out range handling for iterators into a module

This pull request removes the tricky range handling code out into a module.
This makes it much easier to handle ranges correctly, and is backwards compatible with all the ways ranges have been specified in `level-*`

admittedly, this code is less cpu optimal than what was there previously - but it's also a lot simpler,
and raw performance is not the priority - it's more of a guide for implementing other leveldowns,
so I think simplicity is more important.
unnecessary space before `++`