Closed staltz closed 2 years ago
We typically return undefined if the field pointer was -1:
https://github.com/ssb-ngi-pointer/jitdb/blob/1dc806047567b1321fe52494f76b8cb01d846c4a/test/helpers.js#L41
This could be a problem if we later check the return value of these seeker functions, like here:
https://github.com/ssb-ngi-pointer/jitdb/blob/1dc806047567b1321fe52494f76b8cb01d846c4a/index.js#L315-L317
Shouldn't we always return -1 instead of undefined? Could this have been a source of bugs?
-1
undefined
Note:
> ~-1 0 > !~-1 true > ~0 -1 > !~0 false > ~undefined -1 > !~undefined false
cc @arj03
Yep, that looks incorrect
We typically return undefined if the field pointer was -1:
https://github.com/ssb-ngi-pointer/jitdb/blob/1dc806047567b1321fe52494f76b8cb01d846c4a/test/helpers.js#L41
This could be a problem if we later check the return value of these seeker functions, like here:
https://github.com/ssb-ngi-pointer/jitdb/blob/1dc806047567b1321fe52494f76b8cb01d846c4a/index.js#L315-L317
Shouldn't we always return
-1
instead ofundefined
? Could this have been a source of bugs?Note:
cc @arj03