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.

18 lines
284 B

4 years ago
  1. 'use strict';
  2. const callsites = require('callsites');
  3. module.exports = () => {
  4. const c = callsites();
  5. let caller;
  6. for (let i = 0; i < c.length; i++) {
  7. const hasReceiver = c[i].getTypeName() !== null;
  8. if (hasReceiver) {
  9. caller = i;
  10. break;
  11. }
  12. }
  13. return c[caller];
  14. };