@jsenv/abort
Advanced tools
+3
-4
| { | ||
| "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": {} | ||
| } | ||
| } |
+14
-15
@@ -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 @@ |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
18362
0.08%486
0.41%