Skip to content
Allows you to retrieve the filename or directory path of the file that has required your file/module.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
test
.gitattributes
.gitignore
index.js
package.json
readme.md

readme.md

CallerId

Allows you to retrieve the filename or directory path of the file that has required your file/module.

Installation

$ npm install callerid

Features

  • retrieve both the filename and the directory path

methods

  • dirname retrieve the directory path instead of the filename

Usage

Initiate

var callerid = require('callerid');

Get last caller

var file = callerid(),
    dir  = callerid.dirname();

Custom Levels

//back two files
callerid(2);

//directory path two files ago
callerid.dirname(2);

Running tests

$ npm install
$ npm test

License

(The MIT License)

Something went wrong with that request. Please try again.