Socket
Socket
Sign inDemoInstall

pify

Package Overview
Dependencies
0
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 2.1.0

28

index.js

@@ -36,10 +36,26 @@ 'use strict';

pify.all = function (obj, P, opts) {
var ret = {};
if (typeof P !== 'function') {
opts = P;
P = Promise;
}
Object.keys(obj).forEach(function (key) {
opts = opts || {};
var filter = function (key) {
if (opts.include) {
return opts.include.indexOf(key) !== -1;
}
if (opts.exclude) {
return opts.exclude.indexOf(key) === -1;
}
return true;
};
return Object.keys(obj).reduce(function (ret, key) {
var x = obj[key];
ret[key] = typeof x === 'function' ? pify(x, P, opts) : x;
});
return ret;
ret[key] = (typeof x === 'function') && filter(key) ? pify(x, P, opts) : x;
return ret;
}, {});
};
{
"name": "pify",
"version": "2.0.0",
"version": "2.1.0",
"description": "Promisify a callback-style function",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -82,5 +82,21 @@ # pify [![Build Status](https://travis-ci.org/sindresorhus/pify.svg?branch=master)](https://travis-ci.org/sindresorhus/pify)

##### include
Type: `array`
*Works for `pify.all()` only.*
Pick which methods in a module to promisify. Remaining methods will be left untouched.
##### exclude
Type: `array`
*Works for `pify.all()` only.*
Pick which methods in a module **not** to promisify.
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
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