docs: function decorateFunctions(node) {
      var i;
      var funcNode = getCommentedFunctionNode(node);
      if (!funcNode || !funcNode.jsdoc) {
          return;
      }
  
      // Pair up the function params with the JSDoc params (if they exist)
      funcNode.node.params.forEach(function(param) {
          for (i = 0; i < funcNode.jsdoc.params.length; i++) {
              if (!funcNode.jsdoc.params[i].type) {
                  continue;
              }
  
              // If default options are set keep the assignment in flow
              if (param.type === 'AssignmentPattern') {
                  if (funcNode.jsdoc.params[i].name === param.left.name) {
                      // Remove ? if default value is set
                      var type = funcNode.jsdoc.params[i].type.replace(/^\?/, '');
  
                      param.update(
                          param.left.source() + ": " + type + ' = ' + param.right.source()
                      );
                  }
              } else {
                  if (funcNode.jsdoc.params[i].name === param.name) {
                      param.update(
                          param.source() + ": " + funcNode.jsdoc.params[i].type
                      );
                  }
              }
          }
      });
  
      // Pair up the return value if possible
      // we only support 1 return type currently
      var returnDoc = funcNode.jsdoc.returns[0];
      if (returnDoc && returnDoc.type && funcNode.node.body) {
          if (funcNode.node.type === "ArrowFunctionExpression") {
              // we can't just add this to the end as it will then appear AFTER the =>
              // whereas we actually want it BEFORE the =>
              // Sadly, there isn't a nice way to access the bit before the =>. We do
              // however know that the node source is the entire function, and the node
              // body is the stuff between the { }. We can therefore grab the function
              // header portion and find/replace on the fat arrow.
              var funcHeader = funcNode.node.source().replace(funcNode.node.body.source(), "");
              var arrowIndex = funcHeader.lastIndexOf("=>");
              if (arrowIndex === -1) {
                  // well this was unexpected...
                  return;
              }
              // inject annotation before the arrow
              funcHeader = (
                  funcHeader.slice(0, arrowIndex) + ": " + returnDoc.type + " " + funcHeader.slice(arrowIndex)
              );
              // replace the entire function to replace the header portion
              funcNode.node.update(
                  funcHeader + funcNode.node.body.source()
              );
          }
          else {
              funcNode.node.body.update(
                  ": " + returnDoc.type + " " + funcNode.node.body.source()
              );
          }
      }
  }