qauMaWeb/node_modules/@hapi/hoek/lib/wait.js

14 lines
302 B
JavaScript
Raw Normal View History

2024-10-13 18:02:27 +08:00
'use strict';
const internals = {};
module.exports = function (timeout, returnValue) {
if (typeof timeout !== 'number' && timeout !== undefined) {
throw new TypeError('Timeout must be a number');
}
return new Promise((resolve) => setTimeout(resolve, timeout, returnValue));
};