Socket
Socket
Sign inDemoInstall

es6-promisify

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es6-promisify - npm Package Compare versions

Comparing version 6.1.0 to 6.1.1

78

package.json
{
"name": "es6-promisify",
"version": "6.1.0",
"description": "Converts callback-based functions to ES6 Promises",
"main": "dist/promisify.js",
"author": "Mike Hall <mikehall314@gmail.com>",
"keywords": [
"promises",
"es6",
"promisify"
],
"license": "MIT",
"dependencies": {},
"scripts": {
"pretest": "eslint 'lib/*.js' 'test/*.js'",
"build": "babel lib -d dist",
"real-test": "tape test",
"test": "npm run build && npm run real-test",
"test:cover": "npm run build && nyc tape test"
},
"bugs": "http://github.com/digitaldesignlabs/es6-promisify/issues",
"files": [
"dist/promisify.js"
],
"repository": {
"type": "git",
"url": "https://github.com/digitaldesignlabs/es6-promisify.git"
},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.8.7",
"@babel/preset-env": "^7.8.7",
"@puntt/eslint-config": "0.0.2",
"es6-promise": "^4.2.8",
"eslint": "^6.8.0",
"nyc": "^15.0.0",
"prettier": "^1.19.1",
"sinon": "^9.0.1",
"tape": "^4.13.2"
}
"name": "es6-promisify",
"version": "6.1.1",
"description": "Converts callback-based functions to ES6 Promises",
"main": "dist/promisify.js",
"author": "Mike Hall <mikehall314@gmail.com>",
"keywords": [
"promises",
"es6",
"promisify"
],
"license": "MIT",
"scripts": {
"prettier": "prettier --write 'lib/**/*.{js,yml}'",
"lint": "eslint 'lib/*.js' 'test/*.js'",
"pretest": "npm run lint && npm run build",
"build": "babel lib -d dist",
"test": "tape test",
"test:coverage": "nyc npm test"
},
"bugs": "http://github.com/digitaldesignlabs/es6-promisify/issues",
"files": [
"dist/promisify.js"
],
"repository": {
"type": "git",
"url": "https://github.com/digitaldesignlabs/es6-promisify.git"
},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.8.7",
"@babel/preset-env": "^7.8.7",
"@puntt/eslint-config": "0.0.4",
"es6-promise": "^4.2.8",
"eslint": "5.16.0",
"nyc": "^15.0.0",
"prettier": "^2.0.5",
"sinon": "^9.0.1",
"tape": "^4.13.2"
}
}
[![Travis CI](https://travis-ci.org/digitaldesignlabs/es6-promisify.svg)](https://travis-ci.org/digitaldesignlabs/es6-promisify)
# es6-promisify
Converts callback-based functions to ES6/ES2015 Promises, using a boilerplate callback function.
NOTE: All-new API for Version 6.0.0; please read carefully!
===========================================================
## Install
## Install
Install with [npm](https://npmjs.org/package/es6-promisify)

@@ -17,2 +16,3 @@

## Example
```js

@@ -26,10 +26,12 @@ const {promisify} = require("es6-promisify");

// Now usable as a promise!
stat("example.txt").then(function (stats) {
try {
const stats = await stat("example.txt");
console.log("Got stats", stats);
}).catch(function (err) {
} catch (err) {
console.error("Yikes!", err);
});
}
```
## Promisify methods
```js

@@ -43,12 +45,14 @@ const {promisify} = require("es6-promisify");

// Send commands to redis and get a promise back
client("ping").then(function (pong) {
try {
const pong = await client.ping();
console.log("Got", pong);
}).catch(function (err) {
} catch (err) {
console.error("Unexpected error", err);
}).then(function () {
} finally {
redis.quit();
});
}
```
## Handle multiple callback arguments, with named parameters
```js

@@ -66,8 +70,8 @@ const {promisify} = require("es6-promisify");

// Returns named arguments
multi().then(result => {
console.log(result); // {one: 1, two: 2, three: 3}
});
const result = await multi();
console.log(result); // {one: 1, two: 2, three: 3}
```
## Provide your own Promise implementation
```js

@@ -80,9 +84,10 @@ const {promisify} = require("es6-promisify");

const test = promisify(cb => cb(undefined, "test"));
test().then(result => {
console.log(result); // "test", resolved using Bluebird
});
const result = await test();
console.log(result); // "test", resolved using Bluebird
```
### Tests
Test with tape
```bash

@@ -93,7 +98,8 @@ $ npm test

### Changes from v5.0.0
- Allow developer to specify a different implementations of `Promise`
- No longer ships with a polyfill for `Promise`. If your environment has no native `Promise` you must polyfill yourself, or set `promisify.Promise` to an A+ compatible `Promise` implementation.
- Removed support for `settings.thisArg`: use `.bind()` instead.
- Removed support for `settings.multiArgs`: use named arguments instead.
- Allow developer to specify a different implementations of `Promise`
- No longer ships with a polyfill for `Promise`. If your environment has no native `Promise` you must polyfill yourself, or set `promisify.Promise` to an A+ compatible `Promise` implementation.
- Removed support for `settings.thisArg`: use `.bind()` instead.
- Removed support for `settings.multiArgs`: use named arguments instead.
Published under the [MIT License](http://opensource.org/licenses/MIT).
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