Callsite
Get structured callsite information
If you just need structured stack-frames, please use the Stack-Trace library
ESM:
import Callsite from 'es-modules/distributed-systems/callsite/2.0.0+/index.mjs';
NPM:
import Callsite from '@distributed-systems/callsite';
API
Stack Frame format returned from the library
[{
name: 'new Cls',
source: 'stack-trace/test/200.000-stack-parser.mjs',
line: 52,
column: 27
}]
Get Callsite Info
const cs = new Callsite();
const callsite info = cs.getStack();
Get Callsite Info, more frames
const cs = new Callsite();
const callsite info = cs.getStack({
limit: 100,
});
Get Callsite Info, from a custom error
const cs = new Callsite();
const err = new Error('my custom error');
const callsite info = cs.getStack({
limit: 100,
err,
});