'use strict';constcallsites=require('callsites');module.exports=filepath=>{conststacks=callsites();if(!filepath){returnstacks[2].getFileName();}letseenVal=false;// Skip the first stack as it's this functionstacks.shift();for(conststackofstacks){constparentFilepath=stack.getFileName();if(typeofparentFilepath!=='string'){continue;}if(parentFilepath===filepath){seenVal=true;continue;}// Skip native modulesif(parentFilepath==='module.js'){continue;}if(seenVal&&parentFilepath!==filepath){returnparentFilepath;}}};