You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
284 B
19 lines
284 B
4 years ago
|
'use strict';
|
||
|
const callsites = require('callsites');
|
||
|
|
||
|
module.exports = () => {
|
||
|
const c = callsites();
|
||
|
let caller;
|
||
|
|
||
|
for (let i = 0; i < c.length; i++) {
|
||
|
const hasReceiver = c[i].getTypeName() !== null;
|
||
|
|
||
|
if (hasReceiver) {
|
||
|
caller = i;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return c[caller];
|
||
|
};
|