It is the first time I am using Generators in JavaScript (Node.js). I just wanted someone to validate if the implementation is correct. If not, please suggest a better way.<