File tree Expand file tree Collapse file tree 2 files changed +5
-32
lines changed Expand file tree Collapse file tree 2 files changed +5
-32
lines changed Original file line number Diff line number Diff line change 6
6
* MIT Licensed
7
7
*/
8
8
9
+ var getFunctionName = require ( 'get-func-name' ) ;
9
10
/**
10
11
* ### .checkError
11
12
*
@@ -85,36 +86,6 @@ function compatibleMessage(thrown, errMatcher) {
85
86
return false ;
86
87
}
87
88
88
- /**
89
- * ### .getFunctionName(constructorFn)
90
- *
91
- * Returns the name of a function.
92
- * This also includes a polyfill function if `constructorFn.name` is not defined.
93
- *
94
- * @name getFunctionName
95
- * @param {Function } constructorFn
96
- * @namespace Utils
97
- * @api private
98
- */
99
-
100
- var toString = Function . prototype . toString ;
101
- var functionNameMatch = / \s * f u n c t i o n (?: \s | \s * \/ \* [ ^ ( ? : * \/ ) ] + \* \/ \s * ) * ( [ ^ \s \( \/ ] + ) / ;
102
- function getFunctionName ( constructorFn ) {
103
- var name = '' ;
104
- if ( typeof Function . prototype . name === 'undefined' && typeof constructorFn . name === 'undefined' ) {
105
- // Here we run a polyfill if Function does not support the `name` property and if constructorFn.name is not defined
106
- var match = toString . call ( constructorFn ) . match ( functionNameMatch ) ;
107
- if ( match ) {
108
- name = match [ 1 ] ;
109
- }
110
- } else {
111
- // If we've got a `name` property we just use it
112
- name = constructorFn . name ;
113
- }
114
-
115
- return name ;
116
- }
117
-
118
89
/**
119
90
* ### .getConstructorName(errorLike)
120
91
*
@@ -137,7 +108,7 @@ function getConstructorName(errorLike) {
137
108
constructorName = getFunctionName ( errorLike ) ;
138
109
if ( constructorName === '' ) {
139
110
var newConstructorName = getFunctionName ( new errorLike ( ) ) ; // eslint-disable-line new-cap
140
- constructorName = newConstructorName ? newConstructorName : constructorName ;
111
+ constructorName = newConstructorName || constructorName ;
141
112
}
142
113
}
143
114
Original file line number Diff line number Diff line change 54
54
"max-statements" : 0
55
55
}
56
56
},
57
- "dependencies" : {},
57
+ "dependencies" : {
58
+ "get-func-name" : " ^1.0.0"
59
+ },
58
60
"devDependencies" : {
59
61
"browserify" : " ^13.0.0" ,
60
62
"browserify-istanbul" : " ^1.0.0" ,
You can’t perform that action at this time.
0 commit comments