Skip to content

Commit

Permalink
Added support for anonymous callsites. Fixes #5
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Drake authored and klaudiosinani committed Jun 1, 2018
1 parent 7122234 commit a0da14b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions signale.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ class Signale {
const {stack} = new Error();
Error.prepareStackTrace = _;

const callers = stack.map(x => path.basename(x.getFileName()));
const callers = stack.map(x => x.getFileName());

return callers.find(x => {
const firstExternalFilePath = callers.find(x => {
return x !== callers[0];
});

return firstExternalFilePath ? path.basename(firstExternalFilePath) : 'anonymous';
}

get packageConfiguration() {
Expand Down

0 comments on commit a0da14b

Please # to comment.