es6-denodeify

WebJar for es6-denodeify

License

License

GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

es6-denodeify
Last Version

Last Version

0.1.5
Release Date

Release Date

Type

Type

jar
Description

Description

es6-denodeify
WebJar for es6-denodeify
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/valeriangalliat/es6-denodeify

Download es6-denodeify

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/es6-denodeify/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>es6-denodeify</artifactId>
    <version>0.1.5</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/es6-denodeify/
implementation 'org.webjars.npm:es6-denodeify:0.1.5'
// https://jarcasting.com/artifacts/org.webjars.npm/es6-denodeify/
implementation ("org.webjars.npm:es6-denodeify:0.1.5")
'org.webjars.npm:es6-denodeify:jar:0.1.5'
<dependency org="org.webjars.npm" name="es6-denodeify" rev="0.1.5">
  <artifact name="es6-denodeify" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='es6-denodeify', version='0.1.5')
)
libraryDependencies += "org.webjars.npm" % "es6-denodeify" % "0.1.5"
[org.webjars.npm/es6-denodeify "0.1.5"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

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')()

Versions

Version
0.1.5