You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
_read(ops,hash,amount,inclusive){// Find the index of the gt/lt hash, or start from the beginning of the array if not foundconstindex=ops.map((e)=>e.hash).indexOf(hash)letstartIndex=Math.max(index,0)// If gte/lte is set, we include the given hash, if not, start from the next elementstartIndex+=inclusive ? 0 : 1// Slice the array to its requested sizeconstres=ops.slice(startIndex).slice(0,amount)returnres}
If you call this method with a hash (let's say "foobar") that's not present in the EventStore, you'll notice that _read still returns the element at 0th index. We noticed this while using get() method in the FeedStore (https://github.com/orbitdb/orbit-db-feedstore/blob/main/src/FeedStore.js).
This is the get() method in EventStore:
The get() method indirectly calls
_readmethod:If you call this method with a hash (let's say "foobar") that's not present in the EventStore, you'll notice that
_readstill returns the element at 0th index. We noticed this while using get() method in the FeedStore (https://github.com/orbitdb/orbit-db-feedstore/blob/main/src/FeedStore.js).