CallerModule
Provides information about the caller of a method and its module
This module provides the abillity to determine what module performed the most recent function call. It additionally provides information about the module such as:
- Its name
- Its root-path
- The path to the file that performed the function call
- The CallSite-object of the function call (More about the CallSite class...)
Installation
You can install this package using npm:
npm install --save caller-module
Usage
TypeScript-example:
; console.logcallerModule.GetCallerModule.name; // Logs the name of your module.
const callerModule = GetCallerModule;console;
Documentation
require('caller-module').GetCallerModule([method: function], [level: number])
method
:
The method whose caller is to be determined.
Defaults to the GetCallerModule-method.level
: The number of levels above themethod
whose caller is to be determined.
Example
;