Socket
Socket
Sign inDemoInstall

hypercore-promisifier

Package Overview
Dependencies
1
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

README.md

65

index.js

@@ -9,15 +9,2 @@ const { EventEmitter } = require('events')

const PUBLIC_PROPERTIES = [
'key',
'discoveryKey',
'length',
'byteLength',
'writable',
'sparse',
'peers',
'valueEncoding',
'weak',
'lazy'
]
class BaseWrapper extends EventEmitter {

@@ -38,11 +25,43 @@ constructor (core) {

}
get key () {
return this[CORE].key
}
get discoveryKey () {
return this[CORE].discoveryKey
}
get length () {
return this[CORE].length
}
get byteLength () {
return this[CORE].byteLength
}
get writable () {
return this[CORE].writable
}
get sparse () {
return this[CORE].sparse
}
get peers () {
return this[CORE].peers
}
get valueEncoding () {
return this[CORE].valueEncoding
}
get weak () {
return this[CORE].weak
}
get lazy () {
return this[CORE].lazy
}
}
for (const prop of PUBLIC_PROPERTIES) {
Object.defineProperty(BaseWrapper.prototype, prop, {
enumerable: true,
get: function () {
return this[CORE][prop]
}
})
}

@@ -98,5 +117,5 @@ class CallbackToPromiseHypercore extends BaseWrapper {

return new Promise((resolve, reject) => {
this[CORE].seek(bytes, opts, (err, pos) => {
this[CORE].seek(bytes, opts, (err, index, relativeOffset) => {
if (err) return reject(err)
return resolve(pos)
return resolve([index, relativeOffset])
})

@@ -103,0 +122,0 @@ })

{
"name": "hypercore-promisifier",
"version": "1.0.0",
"version": "1.0.1",
"description": "A Hypercore wrapper that lets you switch between callback and Promise APIs",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc