▲ Stupid ES6 Tricks at engineering.haus.com▼1 up and 0 down, posted by emilong 2960 days ago 3 comments
tracker1 2959 days ago. link 2 points ▲ ▼Not ES6, but with async/await, I tend to put this in the top of quite a few of my files, easier as a oneliner than pulling in from a library module a lot of the time. const sleep = ms => new Promise(res => setTimeout(res, ms));
olalonde 2944 days ago. link 1 point ▲ ▼Another one relatively simple: const promisify = fn => (...args) => new Promise(resolve, reject) { fn(...args, (err, result) => { if (err) return reject(err) resolve(result) } }