File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
22
3- var toStr = Object . prototype . toString ;
4- var fnToStr = Function . prototype . toString ;
3+ var callBound = require ( 'call-bound' ) ;
54var safeRegexTest = require ( 'safe-regex-test' ) ;
65var isFnRegex = safeRegexTest ( / ^ \s * (?: f u n c t i o n ) ? \* / ) ;
76var hasToStringTag = require ( 'has-tostringtag/shams' ) ( ) ;
87var getProto = require ( 'get-proto' ) ;
98
9+ var toStr = callBound ( 'Object.prototype.toString' ) ;
10+ var fnToStr = callBound ( 'Function.prototype.toString' ) ;
11+
1012var getGeneratorFunc = function ( ) { // eslint-disable-line consistent-return
1113 if ( ! hasToStringTag ) {
1214 return false ;
@@ -22,11 +24,11 @@ module.exports = function isGeneratorFunction(fn) {
2224 if ( typeof fn !== 'function' ) {
2325 return false ;
2426 }
25- if ( isFnRegex ( fnToStr . call ( fn ) ) ) {
27+ if ( isFnRegex ( fnToStr ( fn ) ) ) {
2628 return true ;
2729 }
2830 if ( ! hasToStringTag ) {
29- var str = toStr . call ( fn ) ;
31+ var str = toStr ( fn ) ;
3032 return str === '[object GeneratorFunction]' ;
3133 }
3234 if ( ! getProto ) {
Original file line number Diff line number Diff line change 4242 "url" : " https://github.com/inspect-js/is-generator-function/issues"
4343 },
4444 "dependencies" : {
45+ "call-bound" : " ^1.0.3" ,
4546 "get-proto" : " ^1.0.0" ,
4647 "has-tostringtag" : " ^1.0.2" ,
4748 "safe-regex-test" : " ^1.1.0"
You can’t perform that action at this time.
0 commit comments