code: function serializeCurrentNode(currentNode) {
    var children = currentNode.children;
    if (!children) {
      return null;
    }
    var len = children.length;
    var arr = new Array(len);
    var i = -1;
    while (++i < len) {
      arr[i] = serializeCurrentNode(children[i]);
    }
    if (currentNode.count) {
      return [arr, currentNode.count];
    } else {
      return [arr];
    }
  }
docs: traverse the thing that the original patch structure called "a', i.e. the virtual tree representing the current node structure. this thing only really needs two properties - "children" and "count", so trim out everything else