Socket
Socket
Sign inDemoInstall

caller

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

caller

@substack's caller.js as a module


Version published
Weekly downloads
187K
decreased by-3.51%
Maintainers
1
Weekly downloads
 
Created

What is caller?

The 'caller' npm package is used to identify the calling function or module in a Node.js application. It helps in debugging, logging, and tracing the flow of execution by providing information about the caller of a function.

What are caller's main functionalities?

Get the calling function

This feature allows you to get the file path of the calling function. In the example, 'caller()' is used inside 'exampleFunction' to log the file path of 'anotherFunction' which called 'exampleFunction'.

const caller = require('caller');

function exampleFunction() {
  console.log('Caller:', caller());
}

function anotherFunction() {
  exampleFunction();
}

anotherFunction();

Get the calling module

This feature allows you to get the file path of the calling module. In the example, 'caller()' is used inside 'exampleFunction' to log the file path of the module that required 'exampleFunction'.

const caller = require('caller');

module.exports = function exampleFunction() {
  console.log('Caller module:', caller());
};

const exampleFunction = require('./exampleFunction');

exampleFunction();

Other packages similar to caller

Keywords

FAQs

Package last updated on 22 Dec 2013

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