Using normal ECMAScript you can do something like,
function f () { console.log(this.constructor.name); }
new f() // outputs `f`
However, a slight modification,
function* f () { console.log(this.constructor.name); }
var g = new f();
g.next() // outputs `GeneratorFunctionPrototype`
Is there anyway to get the generator's name (f
)?