Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private _getRenderModel(model: any): TModel {
// does the given model have a decorated function we can invoke to get a different model to render?
if (EspDecoratorUtil.hasMetadata(model)) {
let metadata: GetEspReactRenderModelMetadata = EspDecoratorUtil.getCustomData(model, GetEspReactRenderModelConsts.CustomDataKey);
if (metadata) {
return model[metadata.functionName]();
}
}
// else see if there is a function with name GetEspReactRenderModelConsts.HandlerFunctionName we can invoke to get a different model to render?
let renderModelGetter = model[GetEspReactRenderModelConsts.HandlerFunctionName];
if (renderModelGetter && utils.isFunction(renderModelGetter)) {
return renderModelGetter.call(model);
}
// else just return the default model
return model;
}
}