Functional programming support (iterator methods) for ES6 generators #JavaScript