Socket
Socket
Sign inDemoInstall

loud-rejection

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loud-rejection - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

api.js

17

index.js
'use strict';
var onExit = require('signal-exit');
var api = require('./api');
var installed = false;

@@ -16,4 +17,2 @@

module.exports = function () {
var unhandledRejections = [];
if (installed) {

@@ -26,15 +25,7 @@ console.trace('WARN: loud rejection called more than once');

process.on('unhandledRejection', function (reason, p) {
unhandledRejections.push({reason: reason, p: p});
});
var tracker = api(process);
process.on('rejectionHandled', function (p) {
var index = unhandledRejections.reduce(function (result, item, idx) {
return (item.p === p ? idx : result);
}, -1);
onExit(function () {
var unhandledRejections = tracker.currentlyUnhandled();
unhandledRejections.splice(index, 1);
});
onExit(function () {
if (unhandledRejections.length > 0) {

@@ -41,0 +32,0 @@ unhandledRejections.forEach(function (x) {

{
"name": "loud-rejection",
"version": "1.1.0",
"version": "1.2.0",
"description": "Make unhandled promise rejections fail loudly instead of the default silent fail",

@@ -20,3 +20,5 @@ "license": "MIT",

"files": [
"index.js"
"index.js",
"register.js",
"api.js"
],

@@ -46,2 +48,3 @@ "keywords": [

"coveralls": "^2.11.4",
"delay": "^1.0.0",
"get-stream": "^1.0.0",

@@ -48,0 +51,0 @@ "nyc": "^3.2.2",

@@ -23,2 +23,3 @@ # loud-rejection [![Build Status](https://travis-ci.org/sindresorhus/loud-rejection.svg?branch=master)](https://travis-ci.org/sindresorhus/loud-rejection) [![Coverage Status](https://coveralls.io/repos/sindresorhus/loud-rejection/badge.svg?branch=master&service=github)](https://coveralls.io/github/sindresorhus/loud-rejection?branch=master)

// Install the unhandledRejection listeners
loudRejection();

@@ -42,5 +43,15 @@

### Register script
Alternatively to the above, you may simply require `loud-rejection/register` and the unhandledRejection listener will be automagically installed for you.
This is handy for ES2015 imports:
```js
import 'loud-rejection/register';
```
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
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