On Fri 28 Aug 2015 07:05, Jane Chen <
jxch...@gmail.com> writes:
> Embedding v8 3.24.
>
> Is there any API to test whether a v8 object is a generator? I tried
> GetConstructorName(), or GetConstructor(), then GetName(), neither gives
> me "GeneratorFunctionPropotype" which I got in JavaScript using g
> ().
constructor.name. The best I seem to get is ObjectProtoToString()
> which returns [object Generator].
>
> Any advice is really appreciated!
var GeneratorFunction = Object.getPrototypeOf(function*(){}).constructor;
function isGeneratorFunction(f) {
return f instanceof GeneratorFunction;
}
Cheers,
Andy