code: function traverse(object, visitor) {
          var child;
  
          if (!object) {
              return;
          }
  
          if (visitor.call(null, object) === false) {
              return false;
          }
          for (var i = 0, keys = Object.keys(object); i < keys.length; i++) {
              child = object[keys[i]];
              if (typeof child === 'object' && child !== null) {
                  if (traverse(child, visitor) === false) {
                      return false;
                  }
              }
          }
      }
docs: From an esprima example for traversing its ast.