1.1.0 • Published 8 years ago

call-trace v1.1.0

Weekly downloads
11
License
MIT
Repository
github
Last release
8 years ago

Call-Trace

This is a really simple module to allow you to see the call stack from the place where the function is executed. This is mostly useful

Essentially it is the same as writing console.log(new Error.stack).

But a (tiny) bit more convenient.

Usage

const trace = require('call-trace');


// somewhere in your code
trace();

You can also provide unlimited arguments, which will cause trace to only log when the argument asserts to a truthy value.

This is particularly useful when debugging because you may wish to only log the call stack when you arrive in a method with a particular set of arguments so you can determine how you got there. e.g.

const weirdValue = 123;

// This will log the function call stack
trace(weirdValue === 123);


const expectedValue = true;

// This will noop
trace(!expectedValue);

Licence

MIT

1.1.0

8 years ago

1.0.0

8 years ago