Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private joinWithPrefix(props: DDL2.IWidgetProperties, imports: Imports, joinStr: string, postFix: string): string {
let retVal: string = "";
let meta: ClassMeta;
if (props.__class) {
meta = classID2Meta(props.__class);
imports.append(meta);
retVal += `new ${meta.class}()`;
}
for (const prop in props) {
if (prop === "__class") {
} else if (isArray(props[prop])) {
const arr = `${(props[prop] as any[]).map(item => this.joinWithPrefix(item, imports, joinStr + " ", "")).join(`,${joinStr} `)}`;
if (arr) {
retVal += `${joinStr} .${prop}([${joinStr} ${arr}${joinStr} ])${postFix}`;
}
} else {
retVal += `${joinStr} .${prop}(${JSON.stringify(props[prop])})${postFix}`;
}
}
return retVal;
}