code: function cleanup(cleanups, start = 0) {
      for(let i = start; i < cleanups.length; ++i) {
          const res = cleanups[i]();
          if(res && res.then)
              return res.then(() => cleanup(cleanups, i+1));
      }
  }
docs: console.log.bind(console);