How to use the @hpcc-js/util.classID2Meta function in @hpcc-js/util

To help you get started, we’ve selected a few @hpcc-js/util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hpcc-systems / Visualization / packages / marshaller / src / ddl2 / javascriptadapter.ts View on Github external
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;
    }