GitShow/sindresorhus/caller-callsite
sindresorhus

caller-callsite

Get the callsite of the caller function

by sindresorhus
Star on GitHubForknpm

JavaScript

54 stars10 forks7 contributorsQuiet · 11mo agoSince 2015v6.0.0MIT

Meet the team

See all 7 on GitHub →
sindresorhus
sindresorhus21 contributions
dideler
dideler1 contribution
BendingBender
BendingBender1 contribution
LitoMore
LitoMore1 contribution
Richienb
Richienb1 contribution
tomhughes
tomhughes1 contribution
yaodingyd
yaodingyd1 contribution

Languages

View on GitHub →
JavaScript100%

Commit activity

Last 12 weeks · 0 commits

Full graph →

Community health

4 of 6 standards met

Community profile →
85
✓README✓License✓Contributing✓Code of Conduct○Issue Template○PR Template

Recent fixes

View closed PRs →
KostyaTretyak
`callerCallsite()` works incorrectly if there is a top-level await before itClosedIssue

Example: In a real-life example, I import another library of yours before calling , where there is a top-level await.

KostyaTretyak · 11mo ago
raphinesse
Why does this module reverse the logical call stack order?ClosedIssue

The descriptions for the property reads: The callsite depth, meaning how many levels we follow back on the stack trace. The topmost item on the call stack ist the currently executing function, if I go one item back, or lower, I will find the stack frame of my caller, then my caller's caller, and so on. So my expectation, which was also corroborated by the description of the property above, was that I would get my own call site for , my caller's for , my caller's caller's site for and so on. But from all I could see, this module completely reverses the call stack with giving the bottommost call site (Node's entry function) and the site of the call to . In any use-case I can think of, one would need to walk the stack _downwards_ from the function calling . However, this is extremely awkward to do with the way works currently. Is there any reason things work as they do now?

raphinesse · 11mo ago
GrayStrider
getFileName just returns the module itselfClosedIssue

GrayStrider · 11mo ago
Structured data for AI agents

Repository: sindresorhus/caller-callsite. Description: Get the callsite of the caller function Stars: 54, Forks: 10. Primary language: JavaScript. Languages: JavaScript (100%). License: MIT. Latest release: v6.0.0 (11mo ago). Open PRs: 0, open issues: 0. Last activity: 11mo ago. Community health: 85%. Top contributors: sindresorhus, dideler, BendingBender, LitoMore, Richienb, tomhughes, yaodingyd.

·@ofershap

Replace github.com with gitshow.dev