Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

es6-denodeify

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es6-denodeify

Convert callbacks to promises.

  • 0.1.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
56K
increased by4.76%
Maintainers
1
Weekly downloads
 
Created
Source

es6-denodeify npm version

Convert callbacks to promises.

Why?

There's already a lot of modules in npm registry to convert callbacks to promises. Why another?

All the modules I found for this purpuse were either depending on some specific promise implementation, or expecting a global Promise constructor. I needed a module that allowed me to inject the promise implementation I'm using. And I found it, it is called promise-denodeify, but since a few weeks it's marked as deprecated, without any recommended alternative solution, and it displays a warning during npm installs when you depend on it, which makes people freak out.

I already tweeted a really simple denodeify implementation, leveraging ES6 arrow functions, and I like it in its brevity. I'm now publishing it as a npm package.

Usage

const denodeify = require('es6-denodeify')(Promise)
const fs = require('fs')
const readFile = denodeify(fs.readFile)

readFile('package.json', 'utf8').then(console.log)

If you have a global Promise constructor and you want es6-denodeify to use it, you can ommit the explicit Promise injection.

const denodeify = require('es6-denodeify')()

FAQs

Package last updated on 11 May 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc