diff --git a/src/components/DevSiteSeo.js b/src/components/DevSiteSeo.js
index a82862751..b3a9c2d67 100644
--- a/src/components/DevSiteSeo.js
+++ b/src/components/DevSiteSeo.js
@@ -78,8 +78,8 @@ function DevSiteSeo({ description, meta, title, tags, location }) {
return (
- {validMetadata.map((data) => (
-
+ {validMetadata.map((data, index) => (
+
))}
diff --git a/src/components/FunctionDefinition.js b/src/components/FunctionDefinition.js
index fd56361ac..e6dcc6cac 100644
--- a/src/components/FunctionDefinition.js
+++ b/src/components/FunctionDefinition.js
@@ -4,10 +4,19 @@ import CodeDef from './CodeDef';
import { graphql } from 'gatsby';
const FunctionDefinition = ({ className, arguments: params, returnValue }) => {
- if (!params.length && !returnValue.length) {
+ const hasParams = params.length;
+ const isReturnArray = Array.isArray(returnValue);
+ const hasReturn =
+ (isReturnArray && returnValue.length) || (!isReturnArray && returnValue);
+
+ if (!hasParams && !hasReturn) {
return null;
}
+ if (!Array.isArray(returnValue)) {
+ returnValue = [returnValue];
+ }
+
return (
function{' '}
@@ -30,7 +39,7 @@ const FunctionDefinition = ({ className, arguments: params, returnValue }) => {
{params.length > 0 && )}
{returnValue.length > 0 && (
<>
- =>
+ =>
{returnValue[0].type}
>
)}
@@ -38,6 +47,11 @@ const FunctionDefinition = ({ className, arguments: params, returnValue }) => {
);
};
+const ReturnValueType = PropTypes.shape({
+ type: PropTypes.string,
+ description: PropTypes.string,
+});
+
FunctionDefinition.propTypes = {
className: PropTypes.string,
arguments: PropTypes.arrayOf(
@@ -47,12 +61,10 @@ FunctionDefinition.propTypes = {
description: PropTypes.string,
})
).isRequired,
- returnValue: PropTypes.arrayOf(
- PropTypes.shape({
- type: PropTypes.string,
- description: PropTypes.string,
- })
- ).isRequired,
+ returnValue: PropTypes.oneOfType([
+ ReturnValueType,
+ PropTypes.arrayOf(ReturnValueType),
+ ]).isRequired,
};
export const query = graphql`
diff --git a/src/components/MethodReference.js b/src/components/MethodReference.js
index 5e15bfe8c..326e56261 100644
--- a/src/components/MethodReference.js
+++ b/src/components/MethodReference.js
@@ -16,12 +16,14 @@ const MethodReference = ({ className, method }) => {
{method.name}
-
+ {method.description && method.description !== 'undefined' && (
+
+ )}