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

@jsenv/abort

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsenv/abort - npm Package Compare versions

Comparing version 4.2.3 to 4.2.4

7

package.json
{
"name": "@jsenv/abort",
"version": "4.2.3",
"version": "4.2.4",
"description": "Help to write code compatible with abort signals",

@@ -12,4 +12,3 @@ "license": "MIT",

"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org"
"access": "public"
},

@@ -38,2 +37,2 @@ "author": {

"dependencies": {}
}
}

@@ -10,3 +10,3 @@ /*

isAbortError: (error) => {
return error.name === "AbortError"
return error && error.name === "AbortError"
},

@@ -177,27 +177,26 @@

const addAbortSource = (abortSourceCallback) => {
const abortSource = {
cleaned: false,
signal: null,
remove: callbackNoop,
}
const abortSourceController = new AbortController()
const abortSourceSignal = abortSourceController.signal
abortSource.signal = abortSourceSignal
if (operationSignal.aborted) {
return {
signal: abortSourceSignal,
remove: callbackNoop,
}
return abortSource
}
const returnValue = abortSourceCallback((value) => {
abortSourceController.abort(value)
})
const removeAbortSource =
typeof returnValue === "function" ? returnValue : callbackNoop
const removeAbortSignal = addAbortSignal(abortSourceSignal, {
onRemove: () => {
removeAbortSource()
if (typeof returnValue === "function") {
returnValue()
}
abortSource.cleaned = true
},
})
return {
signal: abortSourceSignal,
remove: removeAbortSignal,
}
abortSource.remove = removeAbortSignal
return abortSource
}

@@ -204,0 +203,0 @@

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