{"size": 1301, "ext": "js", "max_stars_repo_path": "src/serializers/invana-engine.js", "max_stars_repo_name": "shaw-papadino/graph-explorer", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/serializers/invana-engine.js", "max_issues_repo_name": "shaw-papadino/graph-explorer", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/serializers/invana-engine.js", "max_forks_repo_name": "shaw-papadino/graph-explorer", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.5471698113, "max_line_length": 83, "alphanum_fraction": 0.4704073789}
import DeSerializerBase from "./base";


export default class InvanaEngineDeSerializer extends DeSerializerBase {


    processItem(item) {
        return item;
    }

    convertEdge2Json(edg) {
        edg.source = edg.outV;
        edg.target = edg.inV;
        return edg;
    }

    separateVerticesAndEdges(data, ignoreManagement) {
        if (typeof ignoreManagement === "undefined") {
            ignoreManagement = true;
        }
        let vertices = [];
        let edges = [];
        if (!data) {
            data = []
        }
        let _this = this;
        data.forEach(function (d) {
            if (ignoreManagement) {
                if (d.type === "g:Vertex" && d.label !== "InvanaManagement") {
                    vertices.push(d);
                } else if (d.type === "g:Edge" && d.label !== "InvanaManagement") {
                    edges.push(_this.convertEdge2Json(d));
                }
            } else {
                if (d.type === "g:Vertex") {
                    vertices.push(d);
                } else if (d.type === "g:Edge") {
                    edges.push(_this.convertEdge2Json(d));
                }
            }
        });


        return {"nodes": vertices, "links": edges};
    }

    convertList2Json(items) {
        return items;
    }

}

