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

callback-registry

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

callback-registry - npm Package Compare versions

Comparing version 2.3.1 to 2.3.2

17

lib/index.js

@@ -11,3 +11,3 @@ "use strict";

callbacksForKey.push(callback);
return function () {
return () => {
var allForKey = callbacks[key];

@@ -17,13 +17,12 @@ if (!allForKey) {

}
allForKey = allForKey.filter(function (item) {
return item !== callback;
});
allForKey = allForKey.reduce((acc, element, index) => {
if (!(element === callback && acc.length === index)) {
acc.push(element);
}
return acc;
}, []);
callbacks[key] = allForKey;
};
}
function execute(key) {
var argumentsArr = [];
for (var _i = 1; _i < arguments.length; _i++) {
argumentsArr[_i - 1] = arguments[_i];
}
function execute(key, ...argumentsArr) {
var callbacksForKey = callbacks[key];

@@ -30,0 +29,0 @@ if (!callbacksForKey || callbacksForKey.length === 0) {

{
"name": "callback-registry",
"version": "2.3.1",
"version": "2.3.2",
"description": "Registry for callbacks",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -45,7 +45,7 @@ # Intro

```
# Change log
* 2.3.2
* fix case where unsubscribe function removes all subscriptions with the same callback reference
* 2.1.1
* return empty array as result if no subscribers
* catch errors in user callbacks (returns undefine in the result if error)
* catch errors in user callbacks (returns undefined in the result if error)
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