Skip to content

Commit

Permalink
Improve test/call-analyzer.js
Browse files Browse the repository at this point in the history
  • Loading branch information
cosycode committed May 28, 2018
1 parent c7f87a8 commit 6d3b439
Showing 1 changed file with 33 additions and 13 deletions.
46 changes: 33 additions & 13 deletions test/call-analyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,12 @@
* @param {object} obj
* The object to wrap.
*
* @param {string} objName
* The name in the parent object.
*
* @return {void}
*/
function wrap(obj) {
function wrap(obj, objName) {

var prop;

Expand All @@ -219,7 +222,7 @@

if (typeof prop === 'function') {

obj[key] = createWrapper(prop, key);
obj[key] = createWrapper(prop, objName + '.' + key);

if (typeof prop.prototype !== 'undefined') {
obj[key].prototype = prop.prototype;
Expand All @@ -235,16 +238,33 @@
}
}

wrap(Highcharts.Annotation.prototype);
wrap(Highcharts.Axis.prototype);
wrap(Highcharts.Chart.prototype);
wrap(Highcharts.Legend.prototype);
wrap(Highcharts.Point.prototype);
wrap(Highcharts.Pointer.prototype);
wrap(Highcharts.Series.prototype);
wrap(Highcharts.SVGElement.prototype);
wrap(Highcharts.SVGRenderer.prototype);
wrap(Highcharts.Time.prototype);
for (var className in Highcharts) {

if (typeof Highcharts[className] === 'undefined' ||
Highcharts[className] === null ||
!Highcharts.hasOwnProperty(className)
) {
continue;
}

switch (className) {
default:
continue;
case 'Annotation':
case 'Axis':
case 'Chart':
case 'Legend':
case 'Point':
case 'Pointer':
case 'Series':
case 'SVGElement':
case 'SVGRenderer':
case 'Time':
wrap(Highcharts[className].prototype, className);
break;
}

}

};

Expand Down Expand Up @@ -294,7 +314,7 @@
logString += ' {';
}
logString += '\n' + logSpacing;
logString += (logItem.functionName || '<anonymous>');
logString += (logItem.functionName || '<anonymous>') + '()';
}

if (logString.indexOf('{') >= 0) {
Expand Down

0 comments on commit 6d3b439

Please sign in to comment.