Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

what-line-is-this

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

what-line-is-this

Output a message prefixed with the name and line number of the source file where you outputted the message

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

what-line-is-this

Output a message prefixed with the name and line number of the source file where you outputted the message

npm install what-line-is-this

build status

Usage

Assuming the following file is saved as /Users/maf/index.js

var what = require('what-line-is-this')

var foo = function () {
  what('line is this?')
}

what('line is this?')
foo()

Running it will produce the following output

/Users/maf/index.js:4 - line is this?
/Users/maf/index.js:7 - line is this?

If you wanted to output the line of the calling method instead use what.stack(pos) to change the stack frame being used.

var what = require('what-line-is-this').stack(1)

var foo = function() {
  what('line is this?')
}

foo()

Running the above will print

/Users/maf/index.js:7 - line is this?

License

MIT

FAQs

Package last updated on 16 Oct 2019

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