hand sketched logo of electrons orbiting a nucleus

TIL: How to turn anything into a thenable

If you are ever in a place with a list of things, some of which are promises, you can use Promise.resolve to turn them all into ~promises:

const someList = [
  /* ... */
];

someList.forEach((element) => {
  Promise.resolve(element) // <-- this is the magic
    .then((result) => {
      // do stuff with result...
    })
    .catch();
});