Restructure source and tests

This commit is contained in:
Nick Alteen
2023-09-14 10:36:27 -04:00
parent 570107f4a0
commit ea09560a8d
12 changed files with 294 additions and 94 deletions

17
src/wait.js Normal file
View File

@@ -0,0 +1,17 @@
/**
* Wait for a number of milliseconds.
*
* @param {number} milliseconds The number of milliseconds to wait.
* @returns {Promise<string>} Resolves with 'done!' after the wait is over.
*/
async function wait(milliseconds) {
return new Promise(resolve => {
if (isNaN(milliseconds)) {
throw new Error('milliseconds not a number')
}
setTimeout(() => resolve('done!'), milliseconds)
})
}
module.exports = { wait }