Iterator abstraction as specified in ECMAScript6