added wait function to helpers
This commit is contained in:
parent
4d126ef180
commit
77417da1b4
1 changed files with 8 additions and 1 deletions
|
|
@ -19,6 +19,13 @@ const asyncFilter = async (arr, cb) => {
|
|||
return arr.filter((_, i) => results[i])
|
||||
}
|
||||
|
||||
const wait = (seconds = 0) =>
|
||||
new Promise(resolve => {
|
||||
/** @type {NodeJS.Timeout} */
|
||||
const timer = setTimeout(() => resolve(timer), seconds * 1000)
|
||||
})
|
||||
|
||||
module.exports = {
|
||||
asyncFilter
|
||||
asyncFilter,
|
||||
wait
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue