Socket
Socket
Sign inDemoInstall

@ioredis/as-callback

Package Overview
Dependencies
0
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ioredis/as-callback

A performant and standard (Bluebird) library that registers a node-style callback on a promise


Version published
Maintainers
2
Weekly downloads
257,304
increased by0.32%

Weekly downloads

Readme

Source

Standard asCallback

A performant and standard (Bluebird) library that registers a node-style callback on a promise. It's used by ioredis.

Build Status npm latest version

Install

$ npm install @ioredis/as-callback

Usage

const asCallback = require('@ioredis/as-callback').defaults;

const promise = new Promise(function (resolve) {
  setTimeout(function () {
    resolve('hello world!')
  }, 1000)
})

asCallback(promise, function callback (err, res) {
  console.log(err, res) // null, 'hello world!'
})

Motivation

There are many libraries serve similar functionality. However, none of them I'd found are exactly the same as Bluebird's asCallback function (in terms of either performance or functionality). Thus this library comes out.

Thanks

Most code of this library are ported from the awesome Bluebird library.

License

The MIT License.

Keywords

FAQs

Last updated on 19 Mar 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc