dist/treenode.js
function forEach(callback) {
                if (typeof callback !== 'function') {
                    throw new TypeError('forEach() callback must be a function');
                }

                // run this node through function
                callback(this);

                // do the same for all children
                if (this.children) {
                    for (var i = 0, _length3 = this.children.length; i < _length3; i++) {
                        this.children[i].forEach(callback);
                    }
                }

                return this;
            }
function forEach(callback) {
                if (typeof callback !== 'function') {
                    throw new TypeError('forEach() callback must be a function');
                }

                // run this node through function
                callback(this);

                // do the same for all children
                if (this.children) {
                    for (var i = 0, _length3 = this.children.length; i < _length3; i++) {
                        this.children[i].forEach(callback);
                    }
                }

                return this;
            }
function forEach ( callback ) { if ( typeof callback !== 'function' ) { throw new TypeError ( 'forEach() callback must be a function' ) ; } // run this node through function callback ( this ) ; // do the same for all children if ( this . children ) { for ( var i = 0 , _length3 = this . children . length ; i < _length3 ; i ++ ) { this . children [ i ] . forEach ( callback ) ; } } return this ; }
Pass this node as a parameter to the given callback function. Iteratively pass each child as well.
Returns the current node afterwards.

@param callback A function which will take each node as a parameter.
@returns {TreeNode}
Pass this node as a parameter to the given callback function . Iteratively pass each child as well . Returns the current node afterwards .