Socket
Socket
Sign inDemoInstall

on-finished

Package Overview
Dependencies
1
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.4.0 to 2.4.1

5

HISTORY.md

@@ -0,1 +1,6 @@

2.4.1 / 2022-02-22
==================
* Fix error on early async hooks implementations
2.4.0 / 2022-02-21

@@ -2,0 +7,0 @@ ==================

18

index.js

@@ -209,3 +209,2 @@ /*!

} catch (e) {
/* istanbul ignore next */
return {}

@@ -216,3 +215,4 @@ }

/**
* Wrap function with async resource
* Wrap function with async resource, if possible.
* AsyncResource.bind static method backported.
* @private

@@ -222,10 +222,16 @@ */

function wrap (fn) {
if (!asyncHooks.AsyncResource) {
/* istanbul ignore next */
var res
// create anonymous resource
if (asyncHooks.AsyncResource) {
res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')
}
// incompatible node.js
if (!res || !res.runInAsyncScope) {
return fn
}
// AsyncResource.bind static method backported
var res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')
// return bound function
return res.runInAsyncScope.bind(res, fn, null)
}
{
"name": "on-finished",
"description": "Execute a callback when a request closes, finishes, or errors",
"version": "2.4.0",
"version": "2.4.1",
"contributors": [

@@ -6,0 +6,0 @@ "Douglas Christopher Wilson <doug@somethingdoug.com>",

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