Socket
Socket
Sign inDemoInstall

hypercore-promisifier

Package Overview
Dependencies
2
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.3 to 1.1.0

7

index.js

@@ -294,3 +294,4 @@ const { EventEmitter } = require('events')

toPromises,
toCallbacks
toCallbacks,
unwrap
}

@@ -306,2 +307,6 @@

function unwrap (core) {
return core[CORE] || core
}
function maybeOptional (cb, prom) {

@@ -308,0 +313,0 @@ prom = maybe(cb, prom)

2

package.json
{
"name": "hypercore-promisifier",
"version": "1.0.3",
"version": "1.1.0",
"description": "A Hypercore wrapper that lets you switch between callback and Promise APIs",

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

@@ -26,3 +26,3 @@ # hypercore-promisifier

#### `const { toCallbacks, toPromises } = require('hypercore-promisifier')`
#### `const { toCallbacks, toPromises, unwrap } = require('hypercore-promisifier')`

@@ -35,4 +35,6 @@ `toCallbacks(core)` takes a Hypercore-like object with a Promises API, and returns a wrapper with a

`unwrap(core)` takes either a wrapper object, or a normal Hypercore, and returns a normal (callbacks API) Hypercore.
## License
MIT
const test = require('tape')
const hypercore = require('hypercore')
const ram = require('random-access-memory')
// const hyperspaceSimulator = require('hyperspace/simulator')
const { toPromises } = require('..')
const { toPromises, unwrap } = require('..')

@@ -48,1 +47,9 @@ test('cb hypercore -> promises, simple', async t => {

})
test('can unwrap', async t => {
const core = hypercore(ram, { valueEncoding: 'utf-8' })
const wrapper = toPromises(toPromises(core))
t.same(core, unwrap(wrapper))
t.same(core, unwrap(core))
t.end()
})
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