🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

caller

Package Overview
Dependencies
Maintainers
2
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

1.1.0
latest
Source
npm
Version published
Weekly downloads
201K
0.17%
Maintainers
2
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

caller

FAQs

Package last updated on 10 Mar 2022

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