Visit object hierachy structure
500544
function visitEntry (pkey, context, callback) {
    _(context).chain().keys().each(function (key) {
        var entry = context[key], curkey = pkey?(pkey + '.' + key):key;
        if(_.isFunction(entry) || _.isString(entry) || _.isBoolean(entry) ||
           _.isArray(entry) || _.isNumber(entry) || _.isRegExp(entry)) {//entry is a leaf node
            callback(curkey, entry);
        } else {//entry is not a leaf node
            visitEntry (curkey, entry, callback)
        }
    });
}
811361
function traverse(value, cbs) {
  cbs = cbs || {};

  if (Array.isArray(value)) {
    if (cbs.beforeArray) value = cbs.beforeArray(value, cbs);

    value = value.map(function(v) {
      return traverse(v, cbs);
    });

    if (cbs.afterArray) value = cbs.afterArray(value, cbs);
  } else if (typeof value === 'object') {
    if (cbs.beforeObject) value = cbs.beforeObject(value, cbs);

    Object.keys(value).forEach(function(key) {
      value[key] = traverse(value[key], cbs);
    });

    if (cbs.afterObject) value = cbs.afterObject(value, cbs);
  }

  return value;
}
174666
function visit(ast, context, visitor) {
  var stack;
  var parent;
  var keys = [];
  var index = -1;

  do {
    index++;
    if (stack && index === keys.length) {
      parent = stack.parent;
      keys = stack.keys;
      index = stack.index;
      stack = stack.prev;
    } else {
      var node = parent ? parent[keys[index]] : getProgram(ast);
      if (node && typeof node === 'object' && (node.type || node.length)) {
        if (node.type) {
          var visitFn = visitor[node.type];
          if (visitFn && visitFn(context, node, ast) === false) {
            continue;
          }
        }
        stack = {parent: parent, keys: keys, index: index, prev: stack};
        parent = node;
        keys = Object.keys(node);
        index = -1;
      }
    }
  } while (stack);
}
806819
function traverse(util, searchTerm, options) {
      options = options || {};
      var obj = options.obj || window;
      var path = options.path || ((obj == window) ? 'window' : '');
      var props = Object.keys(obj);
      props.forEach(function(prop) {
        if ((tests[util] || util)(searchTerm, obj, prop)) {
          console.log([path, '.', prop].join(''), '->', ['(', typeof obj[prop], ')'].join(''), obj[prop]);
        }
        if (Object.prototype.toString.call(obj[prop]) == '[object Object]' && (obj[prop] != obj) && path.split('.').indexOf(prop) == -1) {
          traverse(util, searchTerm, {obj: obj[prop], path: [path,prop].join('.')});
        }
      });
    }
1219708
private void visitArray(final ObjectGraphNode node) {
		if (node.getValue() instanceof Object[]) {
			Object[] array = (Object[]) node.getValue();

			for (int i = 0; i < array.length; i++) {
				String entryType = array[i] == null ? Object.class.getName() : array[i].getClass().
						getName();

				ObjectGraphNode childNode = new ObjectGraphNode(++nodeCount, "[" + i + "]",
						entryType, array[i]);
				node.add(childNode);
				visit(childNode);
			}
		} else {
			ObjectGraphNode childNode = new ObjectGraphNode(++nodeCount, "[primitive array]", node.
					getValue().getClass().getName(), node.getValue());
			node.add(childNode);
		}
	}
391047
def _structure_dict(self, obj, cl):
        """"""
        if is_bare(cl) or cl.__args__ == (Any, Any):
            return dict(obj)
        else:
            key_type, val_type = cl.__args__
            if key_type is Any:
                val_conv = self._structure_func.dispatch(val_type)
                return {k: val_conv(v, val_type) for k, v in obj.items()}
            elif val_type is Any:
                key_conv = self._structure_func.dispatch(key_type)
                return {key_conv(k, key_type): v for k, v in obj.items()}
            else:
                key_conv = self._structure_func.dispatch(key_type)
                val_conv = self._structure_func.dispatch(val_type)
                return {
                    key_conv(k, key_type): val_conv(v, val_type)
                    for k, v in obj.items()
                }
1246193
def _get_substructure(self, treelist, pos):
        """"""
        subtree = None
        if len(pos) > 1:
            subtree = self._get_substructure(treelist[pos[0]][1], pos[1:])
        else:
            try:
                subtree = treelist[pos[0]]
            except (IndexError, TypeError):
                pass
        return subtree
1340237
def read_structure(self, cls=Structure):
        """"""
        if self.ngroups != 1:
            raise NotImplementedError("In file %s: ngroups != 1" % self.path)

        return structure_from_ncdata(self, cls=cls)
279515
function topLevelItems(root) {
            var topLevel = [];
            function recur(item) {
                if (isTopLevel(item)) {
                    topLevel.push(item);
                    if (item.children) {
                        for (var _i = 0, _a = item.children; _i < _a.length; _i++) {
                            var child = _a[_i];
                            recur(child);
                        }
                    }
                }
            }
            recur(root);
            return topLevel;
            function isTopLevel(item) {
                switch (navigationBarNodeKind(item)) {
                    case 221 /* ClassDeclaration */:
                    case 192 /* ClassExpression */:
                    case 224 /* EnumDeclaration */:
                    case 222 /* InterfaceDeclaration */:
                    case 225 /* ModuleDeclaration */:
                    case 256 /* SourceFile */:
                    case 223 /* TypeAliasDeclaration */:
                    case 279 /* JSDocTypedefTag */:
                        return true;
                    case 148 /* Constructor */:
                    case 147 /* MethodDeclaration */:
                    case 149 /* GetAccessor */:
                    case 150 /* SetAccessor */:
                        return hasSomeImportantChild(item);
                    case 180 /* ArrowFunction */:
                    case 220 /* FunctionDeclaration */:
                    case 179 /* FunctionExpression */:
                        return isTopLevelFunctionDeclaration(item);
                    default:
                        return false;
                }
                function isTopLevelFunctionDeclaration(item) {
                    if (!item.node.body) {
                        return false;
                    }
                    switch (navigationBarNodeKind(item.parent)) {
                        case 226 /* ModuleBlock */:
                        case 256 /* SourceFile */:
                        case 147 /* MethodDeclaration */:
                        case 148 /* Constructor */:
                            return true;
                        default:
                            return hasSomeImportantChild(item);
                    }
                }
                function hasSomeImportantChild(item) {
                    return ts.forEach(item.children, function (child) {
                        var childKind = navigationBarNodeKind(child);
                        return childKind !== 218 /* VariableDeclaration */ && childKind !== 169 /* BindingElement */;
                    });
                }
            }
        }
388483
function structureAs (name) {
  return function () {
    return [name].concat(isCollection(arguments[0]) ? arguments[0] : slice.call(arguments))
  }
}
786316
private void visit(final ObjectGraphNode currentNode) {
		Object currentValue = currentNode.getValue();

		if (currentValue == null
				|| (currentValue instanceof java.lang.ref.SoftReference)
				|| currentNode.isPrimitive() || currentNode.isSimpleType()) {
			return;
		}

		if (isObjectVisited(currentNode)) {
			ObjectGraphNode ref = visitedNodes.get(currentValue);
			currentNode.setRefNode(ref);
			return;
		}

		markObjectVisited(currentNode);

		if (currentValue instanceof List) {
			// ArrayList's elementData is marked transient, and others may be as well, so we have to do this ourselves.
			visitList(currentNode);
		} else if (currentValue instanceof Map) {
			// HashMap's table is marked transient, and others may be as well, so we have to do this ourselves.
			visitMap(currentNode);
		} else if (currentValue instanceof ComponentModel) {
			// Special case for ComponentModel, so we can figure out if any fields are overridden
			visitComponentModel(currentNode);
		} else if (currentValue instanceof Field) {
			visitComplexType(currentNode);
			summariseNode(currentNode);
		} else if (currentValue.getClass().isArray()) {
			visitArray(currentNode);
		} else {
			visitComplexType(currentNode);
		}
	}
942733
def _structure_list(self, obj, cl):
        """"""
        if is_bare(cl) or cl.__args__[0] is Any:
            return [e for e in obj]
        else:
            elem_type = cl.__args__[0]
            return [
                self._structure_func.dispatch(elem_type)(e, elem_type)
                for e in obj
            ]
1267654
function buildNodeHierachy( nodeId, parentObject, json, allNodes, skins ) {

			var node = allNodes[ nodeId ];
			var nodeDef = json.nodes[ nodeId ];

			// build skeleton here as well

			if ( nodeDef.skin !== undefined ) {

				var meshes = node.isGroup === true ? node.children : [ node ];

				for ( var i = 0, il = meshes.length; i < il; i ++ ) {

					var mesh = meshes[ i ];
					var skinEntry = skins[ nodeDef.skin ];

					var bones = [];
					var boneInverses = [];

					for ( var j = 0, jl = skinEntry.joints.length; j < jl; j ++ ) {

						var jointId = skinEntry.joints[ j ];
						var jointNode = allNodes[ jointId ];

						if ( jointNode ) {

							bones.push( jointNode );

							var mat = new THREE.Matrix4();

							if ( skinEntry.inverseBindMatrices !== undefined ) {

								mat.fromArray( skinEntry.inverseBindMatrices.array, j * 16 );

							}

							boneInverses.push( mat );

						} else {

							console.warn( 'THREE.GLTFLoader: Joint "%s" could not be found.', jointId );

						}

					}

					mesh.bind( new THREE.Skeleton( bones, boneInverses ), mesh.matrixWorld );

				}

			}

			// build node hierachy

			parentObject.add( node );

			if ( nodeDef.children ) {

				var children = nodeDef.children;

				for ( var i = 0, il = children.length; i < il; i ++ ) {

					var child = children[ i ];
					buildNodeHierachy( child, node, json, allNodes, skins );

				}

			}

		}
506825
def visit(self, node):
        """"""
        for child in node:
            yield child
            for subchild in self.visit(child):
                yield subchild
363058
def finalize_structure(self):
        """"""
        self.group_list.append(self.current_group)
        group_set = get_unique_groups(self.group_list)
        for item in self.group_list:
            self.group_type_list.append(group_set.index(item))
        self.group_list = [x.convert_to_dict() for x in group_set]
1346241
def each_object(collection):
    """"""
    c_path = collection_path(collection)
    paths = glob('%s/*.%s' % (c_path, _ext))
    for path in paths:
        yield load_object_at_path(path)
913997
def display_hierarchy_helper(root, parent_id_to_children, depth):
  
  print '%s%s (%s)' % ('%s+--' % ('|'.join(['  '] * depth)),
                       root['name'], root['id'])

  # Recurse for each child of this root that has children.
  for child in parent_id_to_children.get(root['id'], []):
    display_hierarchy_helper(child, parent_id_to_children, depth + 1)