function-timeout
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -12,1 +12,5 @@ // Even though the browser version is a no-op, we wrap it to ensure consistent behavior. | ||
} | ||
export function isTimeoutError() { | ||
return false; | ||
} |
import vm from 'node:vm'; | ||
export default function functionTimeout(function_, {timeout} = {}) { | ||
const script = new vm.Script('returnValue = function_(...arguments_)'); | ||
const script = new vm.Script('returnValue = function_()'); | ||
const wrappedFunction = (...arguments_) => { | ||
const context = { | ||
function_, | ||
arguments_, | ||
function_: () => function_(...arguments_), | ||
}; | ||
@@ -11,0 +10,0 @@ |
{ | ||
"name": "function-timeout", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Make a synchronous function have a timeout", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5885
63