How to rewrite a promise-based function with loops to RxJS observables

It is relatively simple to convert a promise-based function to RxJS observables. Given the following...