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

thenify-all

Package Overview
Dependencies
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

thenify-all - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

History.md

36

index.js
var thenify = require('thenify')
module.exports = function (source, destination, methods) {
module.exports = thenifyAll
/**
* Promisifies all the selected functions in an object.
*
* @param {Object} source the source object for the async functions
* @param {Object} [destination] the destination to set all the promisified methods
* @param {Array} [methods] an array of method names of `source`
* @return {Object}
* @api public
*/
function thenifyAll(source, destination, methods) {
return promisifyAll(source, destination, methods, thenify)
}
/**
* Promisifies all the selected functions in an object and backward compatible with callback.
*
* @param {Object} source the source object for the async functions
* @param {Object} [destination] the destination to set all the promisified methods
* @param {Array} [methods] an array of method names of `source`
* @return {Object}
* @api public
*/
thenifyAll.withCallback= function(source, destination, methods) {
return promisifyAll(source, destination, methods, thenify.withCallback)
}
function promisifyAll(source, destination, methods, promisify) {
if (!destination) {

@@ -19,7 +49,7 @@ destination = {};

if (typeof source === 'function') destination = thenify(source)
if (typeof source === 'function') destination = promisify(source)
methods.forEach(function (name) {
// promisify only if it's a function
if (typeof source[name] === 'function') destination[name] = thenify(source[name])
if (typeof source[name] === 'function') destination[name] = promisify(source[name])
})

@@ -26,0 +56,0 @@

9

package.json
{
"name": "thenify-all",
"description": "Promisifies all the selected functions in an object",
"version": "1.4.0",
"version": "1.5.0",
"author": "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)",

@@ -9,3 +9,3 @@ "license": "MIT",

"dependencies": {
"thenify": "3"
"thenify": "^3.1.0"
},

@@ -31,3 +31,6 @@ "devDependencies": {

"index.js"
]
],
"engines": {
"node": ">=0.10"
}
}

@@ -31,2 +31,4 @@

Promisifies all the selected functions in an object.
- `source` - the source object for the async functions

@@ -36,2 +38,10 @@ - `obj` - the destination to set all the promisified methods

### var obj = thenify.withCallback(source, [obj], [methods])
Promisifies all the selected functions in an object and backward compatible with callback.
- `source` - the source object for the async functions
- `obj` - the destination to set all the promisified methods
- `methods` - an array of method names of `source`
[gitter-image]: https://badges.gitter.im/thenables/thenify-all.png

@@ -38,0 +48,0 @@ [gitter-url]: https://gitter.im/thenables/thenify-all

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