Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

caller-callsite

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

caller-callsite

Get the callsite of the caller function

  • 5.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.5M
decreased by-1.37%
Maintainers
1
Weekly downloads
 
Created

What is caller-callsite?

The caller-callsite npm package allows developers to retrieve information about the call site of the function that called the current function. This can be particularly useful for debugging, logging, and tracking the flow of execution in complex applications. It leverages the V8 stack trace API to provide detailed information about the caller's location in the code.

What are caller-callsite's main functionalities?

Getting caller call site information

This feature allows developers to obtain information about the call site of the function that called the current function. The code sample demonstrates how to use caller-callsite to get the file name and line number of the caller function.

const callerCallsite = require('caller-callsite');

function demoFunction() {
  const callSite = callerCallsite();
  console.log(callSite.getFileName()); // prints the file name of the caller
  console.log(callSite.getLineNumber()); // prints the line number of the caller
}

function callerFunction() {
  demoFunction();
}

callerFunction();

Other packages similar to caller-callsite

Keywords

FAQs

Package last updated on 07 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc