Hacker News new | ask | show | jobs
by tln 1126 days ago
I like it! Another one-liner I'm constantly adding is

    const wait = ms => new Promise(resolve => setTimeout(resolve, ms))
Whatever runs the main function should probably do more, like handling rejections.
1 comments

Same, I've written this so many times. Node just added this as a built-in utility FWIW

https://nodejs.org/api/timers.html#timerspromisessettimeoutd...