Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary condition #82

Closed
vweevers opened this issue Oct 8, 2019 · 1 comment
Closed

Remove unnecessary condition #82

vweevers opened this issue Oct 8, 2019 · 1 comment
Labels
cleanup Housekeeping semver-patch Bug fixes that are backward compatible

Comments

@vweevers
Copy link
Member

vweevers commented Oct 8, 2019

var subdb = reachdown(self.db, 'subleveldown')
if (subdb && subdb.prefix) {
self.prefix = subdb.prefix + self.ownPrefix
self.leveldown = subdb.leveldown
} else {
self.leveldown = reachdown(self.db, matchdown, false)
}

The && subdb.prefix here should not be needed, because at this point we've already determined subdb to be a subleveldown instance and such an instance always has a prefix (even when the user passes in an empty prefix).

If it doesn't have a prefix, that's either a bug or incorrect usage (someone modifying the prefix). Either way it should be surfaced as an error, which is preferable to hitting the else branch on L94, which can result in an incorrect self.leveldown.

@vweevers vweevers added cleanup Housekeeping semver-patch Bug fixes that are backward compatible labels Oct 8, 2019
@vweevers
Copy link
Member Author

vweevers commented Apr 5, 2020

No longer relevant after #89.

@vweevers vweevers closed this as completed Apr 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Housekeeping semver-patch Bug fixes that are backward compatible
Projects
None yet
Development

No branches or pull requests

1 participant