/where-call

get the call function statement location in source code like magic✨✨

Primary LanguageTypeScriptMIT LicenseMIT

Where Call

install

npm install where-call

functions

  • whereIsCallFunction(): Info | null
// source.js
function foo() {
  return whereIsCallFunction();
}
const location = foo();
//       │       ↑
//       └───────┘
//     source.js:4:17
  • whereIsHere(): Info | null
// source.js
function foo() {
  const location = whereIsHere();
//         │       ↑
//         └───────┘
//       source.js:2:19
}
foo();

object

  • Info: location detail
    • line: number
    • column: number
    • file: string

Related