JS References
Function
// 检测 AsyncIterator/Generator
// next, return, throw
console.assert('next' in async function* () {}.prototype);
console.assert('next' in function* () {}.prototype);
(function* () {})[Symbol.toStringTag]; // GeneratorFunction
(async function* () {})[Symbol.toStringTag]; // AsyncGeneratorFunction
(async () => {})[Symbol.toStringTag]; // AsyncFunction
Symbol
Symbol.toStringTag
- Object.prototype.toString()
[object ${@@toStringTag}]