Comparing version 6.6.2 to 6.6.5
@@ -17,6 +17,6 @@ "use strict"; | ||
wait.resolve(res); | ||
return res; | ||
return wait; | ||
} catch(err) { | ||
wait.reject(err); | ||
throw err; | ||
return wait; | ||
} finally { | ||
@@ -23,0 +23,0 @@ wait = null; |
"use strict"; | ||
module.exports = function sleep(timeout) { | ||
return new Promise(function(resolve) { | ||
setTimeout(resolve, timeout); | ||
}); | ||
let max = 2147483647; | ||
module.exports = async function sleep(timeout) { | ||
if(isNaN(timeout) || typeof timeout != "number") | ||
return; | ||
/* istanbul ignore else */ | ||
if(timeout <= max) { | ||
return new Promise(function(resolve) { | ||
setTimeout(resolve, timeout); | ||
}); | ||
} else { | ||
let t = Math.floor(timeout / max), r = timeout % max; | ||
for(let i = 0; i < t; i++) | ||
await sleep(max); | ||
return sleep(r); | ||
} | ||
}; |
{ | ||
"name": "nyks", | ||
"version": "6.6.2", | ||
"version": "6.6.5", | ||
"description": "nodejs exupery style", | ||
@@ -45,3 +45,3 @@ "keywords": [ | ||
"eslint": "eslint .", | ||
"cover": "nyc mocha", | ||
"cover": "nyc mocha test test/async", | ||
"test": "npm run cover test test/async && npm run eslint" | ||
@@ -48,0 +48,0 @@ }, |
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
74928
2022