Open gowpen opened 6 years ago
The kind-of package uses typeof 'function', with generator functions excluded, to detect normal functions.
typeof 'function'
var type = typeof val; if (type === 'boolean') return 'boolean'; if (type === 'string') return 'string'; if (type === 'number') return 'number'; if (type === 'symbol') return 'symbol'; if (type === 'function') { return isGeneratorFn(val) ? 'generatorfunction' : 'function'; }
The isGeneratorFn() function checks the constructor name property to detect generator functions.
function isGeneratorFn(name, val) { return ctorName(name) === 'GeneratorFunction'; }
The kind-of package uses
typeof 'function'
, with generator functions excluded, to detect normal functions.