@distributed-systems/callsite

get structured callsite information

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
00Nov 21, 2018Jan 3, 2018Minified + gzip package size for @distributed-systems/callsite in KB

Readme

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();

// get callsite info
const callsite info = cs.getStack(); 

Get Callsite Info, more frames

const cs = new Callsite();

// get callsite info
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');

// get callsite info
const callsite info = cs.getStack({
    limit: 100,
    err,
});

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.