5 examples of 'node for each' in JavaScript

Every line of 'node for each' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
27function forEachNode(node, visit) {
28 if (node && typeof node === 'object' && !(node instanceof acorn.SourceLocation) && !node._eb_visited) {
29 node._eb_visited = true;
30 visit(node);
31 var keys = Object.keys(node);
32 for (var i=0; i < keys.length; i++) {
33 forEachNode(node[keys[i]], visit);
34 }
35 }
36}
38*eachNode()
39{
40 for (const node of this.uriToNodeMap.values())
41 yield node;
42}
541nodes.forEach(function forEachNode(node, i) {
542 // Make all displayed nodes contentEditable=false,
543 // and ensure that each node's isPlaceholder flag is
544 // set to false.
545 //
546 // This will make the elements appear "accepted"
547 // in the recipients list.
548 node.isPlaceholder = false;
549 node.contentEditable = false;
550 node.setAttribute('role', 'button');
551
552 // The last node should be contentEditable=true
553 // and isPlaceholder=true
554 if (i === nodes.length - 1) {
555 node.isPlaceholder = true;
556 node.contentEditable = true;
557 node.setAttribute('role', 'textbox');
558 } else {
559 // Map the node to it's entry in the list
560 // (only for actual recipient nodes)
561 relation.set(node, list[i]);
562 }
563});
50function each(node) {
51 var id = node.properties.id
52 var data = toString(node)
53
54 if (
55 id &&
56 id.slice(0, 'elements-3:'.length) === 'elements-3:' &&
57 list.indexOf(data) === -1
58 ) {
59 list.push(data)
60 }
61}
398export function forEachChild(node, fn) {
399 childVisitor[node.type](node, fn);
400}

Related snippets