ResJsonConverter.prototype.traverse = function()

in GatewayPluginExample/Ux/gulps/gulp-resjson/resjson-convert.js [102:141]


    ResJsonConverter.prototype.traverse = function (keyItems, indent) {
        var indentSpace = '    ';
        var indentName = '';
        for (var i = 0; i < indent; i++) {
            indentName += indentSpace;
        }
        var indentValue = indentName + indentSpace;
        if (keyItems.length > 0) {
            for (var _i = 0, keyItems_1 = keyItems; _i < keyItems_1.length; _i++) {
                var item = keyItems_1[_i];
                if (indent === 0) {
                    this.outputDefinition.push(ResJsonConverter.openContent);
                    this.outputTypescript.push(ResJsonConverter.openContent);
                    this.outputInterface.push(ResJsonConverter.openContent);
                    this.outputDefinition.push('export declare module ' + item.name + ' {\r\n');
                    this.outputTypescript.push('export module ' + item.name + ' {\r\n    \'use strict\';\r\n');
                    this.outputInterface.push('export interface ' + item.name + ' {\r\n');
                }
                else {
                    this.outputDefinition.push(indentName + 'module ' + item.name + ' {\r\n');
                    this.outputTypescript.push(indentName + 'export module ' + item.name + ' {\r\n');
                    this.outputInterface.push(indentName + item.name + ': {\r\n');
                }
                var jsonOld = this.jsonNewValue(item.name);
                var results = this.scan(item.value);
                for (var _a = 0, _b = results.dataItems; _a < _b.length; _a++) {
                    var item2 = _b[_a];
                    this.outputDefinition.push(indentValue + 'const ' + item2.name + ': string;\r\n');
                    this.outputTypescript.push(indentValue + 'export const ' + item2.name + ' = \'' + item2.value + '\';\r\n');
                    this.outputInterface.push(indentValue + item2.name + ': string;\r\n');
                    this.jsonAddValue(item2.name, item2.value);
                }
                this.traverse(results.keyItems, ++indent);
                this.jsonCurrent = jsonOld;
                this.outputDefinition.push(indentName + '}\r\n');
                this.outputTypescript.push(indentName + '}\r\n');
                this.outputInterface.push(indentName + '};\r\n');
            }
        }
    };