The GeneratorFunction
object provides methods for generator functions. In JavaScript, every generator function is actually a GeneratorFunction
object.
Note that GeneratorFunction
is not a global object. It can be obtained with the following code:
const GeneratorFunction = function* () {}.constructor;
GeneratorFunction
is a subclass of Function
.