Bones/node_modules/callsite
SOUTHERNCO\x2mjbyrn 7efe7605b8 Template Upload
2017-05-17 13:45:25 -04:00
..
.npmignore Template Upload 2017-05-17 13:45:25 -04:00
History.md Template Upload 2017-05-17 13:45:25 -04:00
index.js Template Upload 2017-05-17 13:45:25 -04:00
Makefile Template Upload 2017-05-17 13:45:25 -04:00
package.json Template Upload 2017-05-17 13:45:25 -04:00
Readme.md Template Upload 2017-05-17 13:45:25 -04:00

callstack

Access to v8's "raw" CallSites.

Installation

$ npm install callsite

Example

var stack = require('callsite');

foo();

function foo() {
  bar();
}

function bar() {
  baz();
}

function baz() {
  console.log();
  stack().forEach(function(site){
    console.log('  \033[36m%s\033[90m in %s:%d\033[0m'
      , site.getFunctionName() || 'anonymous'
      , site.getFileName()
      , site.getLineNumber());
  });
  console.log();
}

Why?

Because you can do weird, stupid, clever, wacky things such as:

License

MIT