We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
callerCallsite()
Example:
await Promise.resolve(); const callsites = callerCallsite({ depth: 0 }); console.log(callsites); // undefined
In a real-life example, I import another library of yours before calling callerCallsite(), where there is a top-level await.
The text was updated successfully, but these errors were encountered:
Maybe this will solve this bug:
export function callerCallsite({ depth = 0 } = {}) { const callers = []; const callerFileSet = new Set(); const sliceOfCallsites = callsites(); for (let i = 0; i < sliceOfCallsites.length; i++) { const callsite = sliceOfCallsites[i]; const fileName = callsite.getFileName(); const hasReceiver = callsite.getTypeName() !== null && fileName !== null; if (!callerFileSet.has(fileName) && !fileName?.startsWith('node:internal/')) { callerFileSet.add(fileName); callers.unshift(callsite); } if (hasReceiver || sliceOfCallsites.length == i + 1) { return callers[depth]; } } return; }
Sorry, something went wrong.
fix(core): fixed getCallerDir().
a9d9768
See sindresorhus/caller-callsite#12 for more details.
No branches or pull requests
Example:
In a real-life example, I import another library of yours before calling
callerCallsite()
, where there is a top-level await.The text was updated successfully, but these errors were encountered: