Skip to content

Commit

Permalink
Fixed getFnType logic
Browse files Browse the repository at this point in the history
  • Loading branch information
tibero-yongjun committed May 12, 2021
1 parent 7e11616 commit ea9907d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ function isGeneratorFunction(thing) {
}

const getFnType = (thing) => typeof thing === 'function' && ({
GeneratorFunction: 'generator',
AsyncFunction: 'async',
Function: 'plain'
})[thing.constructor.name];
'[object GeneratorFunction]': 'generator',
'[object AsyncFunction]': 'async',
'[object Function]': 'plain'
})[Object.prototype.toString.call(thing)];


function isGenerator(thing) {
return thing && typeof thing === 'object' && typeof thing.next === 'function';
Expand Down

0 comments on commit ea9907d

Please sign in to comment.