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 66 * MIT Licensed
77 */
88
9+ var getFunctionName = require ( 'get-func-name' ) ;
910/**
1011 * ### .checkError
1112 *
@@ -85,36 +86,6 @@ function compatibleMessage(thrown, errMatcher) {
8586 return false ;
8687}
8788
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-
11889/**
11990 * ### .getConstructorName(errorLike)
12091 *
@@ -137,7 +108,7 @@ function getConstructorName(errorLike) {
137108 constructorName = getFunctionName ( errorLike ) ;
138109 if ( constructorName === '' ) {
139110 var newConstructorName = getFunctionName ( new errorLike ( ) ) ; // eslint-disable-line new-cap
140- constructorName = newConstructorName ? newConstructorName : constructorName ;
111+ constructorName = newConstructorName || constructorName ;
141112 }
142113 }
143114
Original file line number Diff line number Diff line change 5454 "max-statements" : 0
5555 }
5656 },
57- "dependencies" : {},
57+ "dependencies" : {
58+ "get-func-name" : " ^1.0.0"
59+ },
5860 "devDependencies" : {
5961 "browserify" : " ^13.0.0" ,
6062 "browserify-istanbul" : " ^1.0.0" ,
You can’t perform that action at this time.
0 commit comments