I have a function which determines the calling function via Function.caller. Is it possible to determine whether the caller belongs to a class, is a class, etc?
(I Know that when function.caller == null
it is the root level from which it was called.)
Some code which may help in understand what i'm trying to achieve.
log(component: object, level: LogLevel, category: ILogCategory, message: string)
{
if(!component)
let callingComponent = log.caller;
// PSEUDOCODE
if(parent of caller is class)
callingComponent = class;
//...
}
}
EDIT
I want to get the class to which the caller of my method belongs to.