recursive helper function
@api private
977950
function _checkCircular (opts, obj) {
  var key
  if (util.isObject(obj)) {
    if (~opts._visited.indexOf(obj)) {
      return true
    }
    opts._visited.push(obj)
    for (key in obj) {
      if (obj.hasOwnProperty(key) && _checkCircular(opts, obj[key])) {
        return true
      }
    }
  }
  return false
}
341856
def traverse(flag=nil,&op)
		op.call(self)
		all_children_deep(flag).each do |c|
			op.call(c)
		end
	end
1351060
function (callback, ctx) {
            var _walk = function (depth, node, ctx) {
                if (typeof callback === "function")
                    ctx = callback(depth, node, ctx, false);
                var children = node.children();
                for (var i = 0; i < children.length; i++)
                    ctx = _walk(depth + 1, children[i], ctx);
                if (typeof callback === "function")
                    ctx = callback(depth, node, ctx, true);
                return ctx;
            };
            ctx = _walk(0, this, ctx);
            return ctx;
        }
5768
function tree() {
            var result = {
                name: 'root',
                children: []
            }

            function _parseChildren(parentClientId, children) {
                Util.each(CACHE, function(item) {
                    if (item.parentClientId === parentClientId) {
                        children.push({
                            name: item.moduleId + ',' + item.clientId,
                            module: item,
                            children: _parseChildren(item.clientId, [])
                        })
                    }
                })
                return children
            }

            _parseChildren(Constant.ROOT_CLIENT_ID, result.children)

            return result
        }
668977
function recurvsiveFlatten(name, obj, arr, depth){

  var type;

  // "items" property flags a nested object or array, so it needs special treatment
  if (obj.hasOwnProperty('items')) {

    type = obj.items.type;

    // Keep track of what type of array this is (if it is an array type)
    if (obj.type === 'array') {
      type = lodash.capitalize(type) + '[]';
    }

    // Add the object or array to the flattened property array
    arr.push({name: name, type: type, description: obj.description || '', depth: depth});

    // Loop thru the item's properties and execute the recursive function
    lodash.forIn(obj.items.properties, function (val, key) {
      recurvsiveFlatten(key, val, arr, depth + 1);
    });

  } else if (obj.hasOwnProperty('properties')) {

    // Add the object to the flattened property array
    arr.push({name: name, type: 'Object', description: obj.description || '', depth: depth});

    // Execute the recursive function on all properties
    lodash.forIn(obj.properties, function(val, key){
      recurvsiveFlatten(key, val, arr, depth + 1);
    });
  } else {

    // Add the property to the flattened property array
    arr.push({name: name, type: obj.type, description: obj.description, depth: depth});
  }

}
1302123
function recursiveMerge (target, src) {
    for (var prop in src) {
        if (src.hasOwnProperty(prop)) {
            if (target.prototype && target.prototype.constructor === target) {
                // If the target object is a constructor override off prototype.
                clobber(target.prototype, prop, src[prop]);
            } else {
                if (typeof src[prop] === 'object' && typeof target[prop] === 'object') {
                    recursiveMerge(target[prop], src[prop]);
                } else {
                    clobber(target, prop, src[prop]);
                }
            }
        }
    }
}
687523
function( options ){
			
			var parents = helpers.getParentsPathToSelf(getCurrent().name);
			
			for(var i = 0; i < parents.length; i++){
				
				if( parents[i].name === this.name ){
					return options.fn(this);
				}
			}
			
			return options.inverse(this);
			
		}
982678
function(parentNode, reverse, ofType) {
      parentNode._counted = true;
      if (reverse) {
        for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
          var node = nodes[i];
          if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++;
        }
      } else {
        for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
          if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++;
      }
    }
308683
def recursive_apply(inval, func):
    '''
    '''
    if isinstance(inval, dict):
        return {k: recursive_apply(v, func) for k, v in inval.items()}
    elif isinstance(inval, list):
        return [recursive_apply(v, func) for v in inval]
    else:
        return func(inval)
845321
def recursive_iterator(func):
    """"""
    tee_store = {}
    @_coconut.functools.wraps(func)
    def recursive_iterator_func(*args, **kwargs):
        hashable_args_kwargs = _coconut.pickle.dumps((args, kwargs), _coconut.pickle.HIGHEST_PROTOCOL)
        try:
            to_tee = tee_store[hashable_args_kwargs]
        except _coconut.KeyError:
            to_tee = func(*args, **kwargs)
        tee_store[hashable_args_kwargs], to_return = _coconut_tee(to_tee)
        return to_return
    return recursive_iterator_func
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 */;
                    });
                }
            }
        }
898853
def recursive_get(obj, key):
    '''
    
    '''
    if not obj or not key:
        return
    parts = key.split('.') if isinstance(key, basestring) else key
    key = parts.pop(0)
    if isinstance(obj, dict):
        value = obj.get(key, None)
    else:
        value = getattr(obj, key, None)
    return recursive_get(value, parts) if parts else value
169095
function TreeIterator(tree) {

    // the tree, current slot index, and previous and next pointers are private attributes
    // so methods that use them are defined in the constructor
    var currentSlot = 0;  // the slot before the first item
    var previous = undefined;
    var next = minimum(tree.root);

    this.toStart = function() {
        currentSlot = 0;  // the slot before the first item
        previous = undefined;
        next = minimum(tree.root);
    };

    this.toSlot = function(slot) {
        currentSlot = slot;
        previous = tree.node(slot - 1);  // javascript index of item before the slot
        next = successor(previous);
    };

    this.toEnd = function() {
        currentSlot = tree.size;  // the slot after the last item
        previous = maximum(tree.root);
        next = undefined;
    };

    this.hasPrevious = function() {
        return currentSlot > 0;
    };

    this.hasNext = function() {
        return currentSlot < tree.size;
    };

    this.getPrevious = function() {
        if (!this.hasPrevious()) return;
        const value = previous.value;
        next = previous;
        previous = predecessor(next);
        currentSlot--;
        return value;
    };

    this.getNext = function() {
        if (!this.hasNext()) return;
        const value = next.value;
        previous = next;
        next = successor(previous);
        currentSlot++;
        return value;
    };

    return this;
}
1245694
function nest(array, insert) {
  let obj;

  array.reverse().forEach(key => {
    obj = { [key]: insert };
    insert = obj;
  });

  return insert;
}
123745
function(parentNode, reverse, ofType) {
      parentNode._countedByPrototype = Prototype.emptyFunction;
      if (reverse) {
        for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
          var node = nodes[i];
          if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
        }
      } else {
        for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
          if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
      }
    }
913739
function (node, options, recursive) {
			options = (options)? options : {};

			// recursive calls
		    if (recursive === undefined) {
		        if (node.parentNode && node.nodeName !== 'HTML'){
		            return this.getParentTreeWalk(node.parentNode, options, true);
				}else{
		            return this.formatEmpty();
				}
		    }
		    if (node !== null && node !== undefined && node.parentNode) {
		        if (this.isMicroformat( node, options )) {
					// if we have a match return microformat
					options.node = node;
		            return this.get( options );
		        }else{
		            return this.getParentTreeWalk(node.parentNode, options, true);
		        }
		    }else{
		        return this.formatEmpty();
		    }
		}
1333346
def each_recursive(&block) # :yields: node
      self.elements.each {|node|
        block.call(node)
        node.each_recursive(&block)
      }
    end