Created
October 20, 2015 21:40
-
-
Save lemnis/b6112c592095b0755971 to your computer and use it in GitHub Desktop.
Revisions
-
lemnis created this gist
Oct 20, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,57 @@ var debug = { getCallstack: function(){ var err = (new Error), caller_stack = err.stack.split("\n"), stack = []; for (var i = 0; i < caller_stack.length; i++) { var caller = caller_stack[i], caller_line = caller.split(":"), caller_nf = caller_line[0].split("@"), caller_name = caller_nf[0], caller_file = caller_nf[1].split("/"); stack.push({ file: caller_file[caller_file.length - 1], name: caller_name, line: caller_line[2], column: caller_line[1] }); }; return stack; }, log: function(message){ var callee = this.getCallstack()[1]; log("## Func: " + callee.name + " ## " + callee.file + ":"+ callee.line + ":" + callee.column ); log(message); }, dump: function(obj){ log("#####################################################################################") log("## Dumping object " + obj ) log("## obj class is: " + [obj className]) log("#####################################################################################") log("obj.properties:") log([obj class].mocha().properties()) log("obj.propertiesWithAncestors:") log([obj class].mocha().propertiesWithAncestors()) log("obj.classMethods:") log([obj class].mocha().classMethods()) log("obj.classMethodsWithAncestors:") log([obj class].mocha().classMethodsWithAncestors()) log("obj.instanceMethods:") log([obj class].mocha().instanceMethods()) log("obj.instanceMethodsWithAncestors:") log([obj class].mocha().instanceMethodsWithAncestors()) log("obj.protocols:") log([obj class].mocha().protocols()) log("obj.protocolsWithAncestors:") log([obj class].mocha().protocolsWithAncestors()) log("obj.treeAsDictionary():") log(obj.treeAsDictionary()) } }