hypercore 10.0.0-alpha.43 → 10.0.0-alpha.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -191,8 +191,10 @@ module.exports = class Hypercore extends EventEmitter {
191
191
 
192
192
  s._passCapabilities(this)
193
193
 
194
- // Pass on the cache unless explicitly disabled.
195
- if (opts.cache !== false) s.cache = this.cache
194
+ // Configure the cache unless explicitly disabled.
195
+ if (opts.cache !== false) {
196
+ s.cache = opts.cache === true || !opts.cache ? this.cache : opts.cache
197
+ }
196
198
 
197
199
  ensureEncryption(s, opts)
198
200
 
package/lib/replicator.js CHANGED
@@ -910,9 +910,9 @@ module.exports = class Replicator {
910
910
  }
911
911
 
912
912
  addRange (session, { start = 0, end = -1, length = toLength(start, end), blocks = null, linear = false } = {}) {
913
- if (blocks !== null) {
914
- if (start >= blocks.length) start = blocks.length
915
- if (length === -1 || start + length > blocks.length) length = blocks.length - start
913
+ if (blocks !== null) { // if using blocks, start, end just acts as frames around the blocks array
914
+ start = 0
915
+ end = length = blocks.length
916
916
  }
917
917
 
918
918
  const r = new RangeRequest(this._ranges, start, length === -1 ? -1 : start + length, linear, blocks)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore",
3
- "version": "10.0.0-alpha.43",
3
+ "version": "10.0.0-alpha.44",
4
4
  "description": "Hypercore 10",
5
5
  "main": "index.js",
6
6
  "scripts": {