New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@axah/koa

Package Overview
Dependencies
Maintainers
11
Versions
159
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@axah/koa - npm Package Compare versions

Comparing version 5.7.0 to 5.7.1

51

lib/log/utils.js

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

const original = emitter[method];
const wrapped = wrapper(original, method);
const wrapped = wrapper(original);
wrapped[isWrappedSymbol] = true;

@@ -21,19 +21,50 @@ // eslint-disable-next-line no-param-reassign

/**
* Wraps EventEmitter listener registration methods of the
* given emitter, so that all listeners are run in scope of
* the provided async resource.
* Wraps EventEmitter listener registration methods of the given emitter,
* so that all listeners are run in scope of the provided async resource.
*
* Supports registering same listener function to multiple events (or
* even the same one), as well as subsequent deregistering.
*/
function wrapEmitter(emitter, asyncResource) {
for (const method of addMethods) {
wrapEmitterMethod(emitter, method, (original) => function wrap(name, handler) {
// eslint-disable-next-line no-param-reassign
handler[wrappedSymbol] = asyncResource.runInAsyncScope.bind(asyncResource, handler, emitter);
wrapEmitterMethod(emitter, method, (original) => function wrap(event, handler) {
let wrapped = emitter[wrappedSymbol];
if (wrapped === undefined) {
wrapped = {};
// eslint-disable-next-line no-param-reassign
emitter[wrappedSymbol] = wrapped;
}
const wrappedHandler = asyncResource.runInAsyncScope.bind(asyncResource, handler, emitter);
const existing = wrapped[event];
if (existing === undefined) {
wrapped[event] = wrappedHandler;
}
else if (typeof existing === 'function') {
wrapped[event] = [existing, wrappedHandler];
}
else {
wrapped[event].push(wrappedHandler);
}
// @ts-ignore
return original.call(this, name, handler[wrappedSymbol]);
return original.call(this, event, wrappedHandler);
});
}
for (const method of removeMethods) {
wrapEmitterMethod(emitter, method, (original) => function wrap(name, handler) {
wrapEmitterMethod(emitter, method, (original) => function wrap(event, handler) {
let wrappedHandler;
const wrapped = emitter[wrappedSymbol];
if (wrapped !== undefined) {
const existing = wrapped[event];
if (existing !== undefined) {
if (typeof existing === 'function') {
wrappedHandler = existing;
delete wrapped[event];
}
else {
wrappedHandler = existing.pop();
}
}
}
// @ts-ignore
return original.call(this, name, handler[wrappedSymbol] || handler);
return original.call(this, event, wrappedHandler || handler);
});

@@ -40,0 +71,0 @@ }

2

package.json
{
"name": "@axah/koa",
"version": "5.7.0",
"version": "5.7.1",
"main": "lib/index.js",

@@ -5,0 +5,0 @@ "license": "UNLICENSED",

Sorry, the diff of this file is not supported yet

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