Socket
Socket
Sign inDemoInstall

a-wait-forit

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.2 to 0.1.3

18

lib/index.js
"use strict";
const nextMiddleware = (a, b) => {
b(a);
};
exports.wait = (promise, onerror, inext = 2) => (...argv) => {

@@ -7,19 +11,11 @@ const next = argv[inext]; // expect middleware's `next` by default

if (onerror && typeof onerror !== 'function') throw new TypeError('`onerror` has wrong type');
const nextMiddleware = error => {
next(error);
};
return promise(...argv).catch(error => {
if (onerror) return onerror(error, next);
nextMiddleware(error);
return onerror ? onerror(error, next) : nextMiddleware(error, next);
});
};
exports.forit = (maybePromise
/*: Promise | () => Promise */
, onerror) => {
onerror = onerror || (_ => [_]);
exports.forit = (maybePromise, onerror) => {
const onError = onerror || (_ => [_]);
return (typeof maybePromise === 'function' ? maybePromise() : maybePromise).then(_ => [undefined, _]).catch(onerror);
};
{
"name": "a-wait-forit",
"version": "0.1.2",
"version": "0.1.3",
"description": "",

@@ -27,3 +27,4 @@ "keywords": [

"directories": {
"lib": "src"
"lib": "src",
"test": "test"
},

@@ -38,4 +39,6 @@ "scripts": {

"@babel/plugin-proposal-object-rest-spread": "^7.3.1",
"@babel/preset-env": "^7.3.1"
"@babel/preset-env": "^7.3.1",
"@babel/preset-flow": "^7.0.0",
"flow-bin": "^0.92.0"
}
}
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