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

async-compatibilty

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

async-compatibilty - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

19

lib/asyncValue.js

@@ -0,13 +1,14 @@

var isError = require('is-error');
var isPromise = require('is-promise');
module.exports = function asyncValue(value, callback) {
isPromise(value)
? value
.then(function (result) {
callback(null, result);
})
.catch(function (err) {
callback(err);
})
: callback(null, value);
if (isError(value)) return callback(value);
if (!isPromise(value)) return callback(null, value);
value
.then(function (result) {
callback(null, result);
})
.catch(function (err) {
callback(err);
});
};
{
"name": "async-compatibilty",
"version": "1.2.0",
"version": "1.3.0",
"description": "Compatibility functions for writing libraries that support both callbacks and promises",

@@ -29,2 +29,3 @@ "main": "index.js",

"dependencies": {
"is-error": "^2.2.2",
"is-promise": "^2.1.0"

@@ -31,0 +32,0 @@ },

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