Readme.md (631B)
1 # callstack 2 3 Access to v8's "raw" `CallSite`s. 4 5 ## Installation 6 7 $ npm install callsite 8 9 ## Example 10 11 ```js 12 var stack = require('callsite'); 13 14 foo(); 15 16 function foo() { 17 bar(); 18 } 19 20 function bar() { 21 baz(); 22 } 23 24 function baz() { 25 console.log(); 26 stack().forEach(function(site){ 27 console.log(' \033[36m%s\033[90m in %s:%d\033[0m' 28 , site.getFunctionName() || 'anonymous' 29 , site.getFileName() 30 , site.getLineNumber()); 31 }); 32 console.log(); 33 } 34 ``` 35 36 ## Why? 37 38 Because you can do weird, stupid, clever, wacky things such as: 39 40 - [better-assert](https://github.com/visionmedia/better-assert) 41 42 ## License 43 44 MIT