How to use the dojo/_base/array.forEach function in dojo

To help you get started, we’ve selected a few dojo 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 / HPCC-Platform / esp / src / src / ESPGraph.ts View on Github external
calcSubgraphVisibility: function (subgraph, localisationDepth) {
        if (localisationDepth < 0) {
            return;
        }

        if (localisationDepth > 0) {
            arrayUtil.forEach(subgraph.__hpcc_subgraphs, function (subgraph, idx) {
                this.calcSubgraphVisibility(subgraph, localisationDepth - 1);
            }, this);
        }

        arrayUtil.forEach(subgraph.__hpcc_subgraphs, function (subgraph, idx) {
            this.m_visibleSubgraphs[subgraph.__hpcc_id] = subgraph;
        }, this);
        arrayUtil.forEach(subgraph.__hpcc_vertices, function (vertex, idx) {
            this.m_visibleVertices[vertex.__hpcc_id] = vertex;
        }, this);

        //  Calculate edges that pass through the subgraph  ---
        var dedupEdges = {};
        arrayUtil.forEach(this.graph.edges, function (edge, idx) {
            if (edge.getSource().__hpcc_parent !== edge.getTarget().__hpcc_parent && subgraph === this.getCommonAncestor(edge)) {
                //  Only include one unique edge between subgraphs  ---
                if (!dedupEdges[edge.getSource().__hpcc_parent.__hpcc_id + "::" + edge.getTarget().__hpcc_parent.__hpcc_id]) {
                    dedupEdges[edge.getSource().__hpcc_parent.__hpcc_id + "::" + edge.getTarget().__hpcc_parent.__hpcc_id] = true;
                    this.m_visibleEdges[edge.__hpcc_id] = edge;
                }
            }
github hpcc-systems / HPCC-Platform / esp / src / src / WsDfu.ts View on Github external
return ESPRequest.send("WsDfu", "DFUDefFile", params).then(function (response) {
        try {
            var domXml = parser.parse(response);
            var espBase = new ESPBase();
            var exceptions = espBase.getValues(domXml, "Exception", ["Exception"]);
            if (exceptions.length) {
                response = "";
                arrayUtil.forEach(exceptions, function (item, idx) {
                    response += item.Message + "\n";
                });
            }
        } catch (e) {
            //  No errors  ---
        }
        return response;
    });
}
github hpcc-systems / HPCC-Platform / esp / src / src / ESPGraph.ts View on Github external
var vertex = new Vertex(this, id);
                    this.vertices.push(vertex);
                    this.idx[id] = vertex;
                    break;
                case "edge":
                    var edge = new Edge(this, id);
                    this.edges.push(edge);
                    this.idx[id] = edge;
                    break;
                default:
                    console.log("Graph.getItem - Unknown Node Type!");
                    break;
            }
        }
        var retVal = this.idx[id];
        arrayUtil.forEach(docNode.attributes, function (attr, idx) {
            retVal[attr.name] = attr.value;
        }, this);
        return retVal;
    },
github hpcc-systems / HPCC-Platform / esp / src / src / ESPTopology.ts View on Github external
_TpMachinesSetter: function (TpMachines) {
        if (lang.exists("TpMachine", TpMachines)) {
            arrayUtil.forEach(TpMachines.TpMachine, function (item, idx) {
                var newMachine = createTreeItem(TpMachine, item.Type + "_" + item.Netaddress + "_" + item.ProcessNumber + "_" + item.Directory, this, item)
                this.appendChild(newMachine);
            }, this);
        }
    },
    updateData: ESPUtil.override(function (inherited, data) {
github hpcc-systems / HPCC-Platform / esp / src / src / FileSpray.ts View on Github external
return ESPRequest.send("FileSpray", "GetDFUWorkunit", params).then(function (response) {
        if (lang.exists("Exceptions.Exception", response)) {
            arrayUtil.forEach(response.Exceptions.Exception, function (item, idx) {
                if (item.Code === 20080) {
                    lang.mixin(response, {
                        GetDFUWorkunitResponse: {
                            result: {
                                Wuid: params.request.Wuid,
                                State: 999,
                                StateMessage: "not found"
                            }
                        }
                    });
                }
            });
        }
        return response;
    });
}
github hpcc-systems / HPCC-Platform / esp / src / src / ESPTopology.ts View on Github external
}).then(function (response) {
                var clusterTypes = {};
                var retVal = [];
                if (lang.exists("TpTargetClusterQueryResponse.TpTargetClusters", response)) {
                    arrayUtil.forEach(response.TpTargetClusterQueryResponse.TpTargetClusters.TpTargetCluster, function (item, idx) {
                        if (!clusterTypes[item.Type]) {
                            clusterTypes[item.Type] = createTreeItem(TargetClusterType, item.Type, context.rootItem, { Name: item.Type })
                            retVal.push(clusterTypes[item.Type]);
                        }
                        clusterTypes[item.Type].appendChild(createTreeItem(TargetCluster, item.Name, context.rootItem, item));
                    }, this);
                }
                return retVal;
            }),
            serviceQuery: WsTopology.TpServiceQuery({
github hpcc-systems / HPCC-Platform / esp / src / src / ESPGraph.ts View on Github external
calcInVertexVisibility: function (vertex, localisationDistance) {
        if (this.noSpills && vertex.isSpill()) {
            localisationDistance++;
        }
        this.m_visibleVertices[vertex.__hpcc_id] = vertex;
        if (localisationDistance > 0) {
            arrayUtil.forEach(vertex.getInEdges(), function (edge, idx) {
                this.calcInVertexVisibility(edge.getSource(), localisationDistance - 1);
            }, this);
        }
    },
github hpcc-systems / HPCC-Platform / esp / src / src / ESPGraph.ts View on Github external
remove: function () {
        arrayUtil.forEach(this.__hpcc_subgraphs, function (subgraph) {
            subgraph.__hpcc_parent = this.__hpcc_parent;
        }, this);
        arrayUtil.forEach(this.__hpcc_vertices, function (vertex) {
            vertex.__hpcc_parent = this.__hpcc_parent;
        }, this);
        arrayUtil.forEach(this.__hpcc_edges, function (edge) {
            edge.__hpcc_parent = this.__hpcc_parent;
        }, this);
        delete this.__hpcc_parent;
        this.__hpcc_graph.removeItem(this);
    },
github hpcc-systems / HPCC-Platform / esp / src / src / ESPLogicalFile.ts View on Github external
arrayUtil.forEach(DFUFilePartsOnClusters.DFUFilePartsOnCluster, function (DFUFilePartsOnCluster, idx) {
                if (lang.exists("DFUFileParts.DFUPart", DFUFilePartsOnCluster)) {
                    arrayUtil.forEach(DFUFilePartsOnCluster.DFUFileParts.DFUPart, function (DFUPart, idx) {
                        DFUFileParts.DFUPart.push(lang.mixin({
                            __hpcc_id: DFUPart.Id + "--" + DFUPart.Copy,
                            Cluster: DFUFilePartsOnCluster.Cluster
                        }, DFUPart));
                    }, this);
                }
                if (idx === 0) {
                    this.set("CanReplicateFlag", DFUFilePartsOnCluster.CanReplicate);
                    this.set("ReplicateFlag", DFUFilePartsOnCluster.Replicate);
                }
            }, this);
        }
github hpcc-systems / HPCC-Platform / esp / src / src / ESPGraph.ts View on Github external
walkDocument: function (docNode, id) {
        var retVal = this.getItem(docNode, id);
        arrayUtil.forEach(docNode.childNodes, function (childNode, idx) {
            switch (childNode.nodeType) {
                case 1:     //	ELEMENT_NODE
                    switch (childNode.tagName) {
                        case "graph":
                            break;
                        case "node":
                            var isSubgraph = false;
                            var attNode = this.getChildByTagName(childNode, "att");
                            if (attNode) {
                                var graphNode = this.getChildByTagName(attNode, "graph");
                                if (graphNode) {
                                    isSubgraph = true;
                                    var subgraph = this.walkDocument(graphNode, childNode.getAttribute("id"));
                                    retVal.addSubgraph(subgraph);
                                }
                            }

dojo

Dojo core is a powerful, lightweight library that makes common tasks quicker and easier. Animate elements, manipulate the DOM, and query with easy CSS syntax, all without sacrificing performance.

BSD-3-Clause OR AFL-2.1
Latest version published 2 years ago

Package Health Score

60 / 100
Full package analysis