util.types.isGeneratorFunction(value)
如果该值是生成器函数,则返回 true。
这仅反映 JavaScript 引擎看到的情况;
特别地,如果使用了转译工具,返回值可能与原始源码不符。
【Returns true if the value is a generator function.
This only reports back what the JavaScript engine is seeing;
in particular, the return value may not match the original source code if
a transpilation tool was used.】
util.types.isGeneratorFunction(function foo() {}); // Returns false
util.types.isGeneratorFunction(function* foo() {}); // Returns true