Commit ce5a5980 authored by Ben Galloway's avatar Ben Galloway

More sensible returning of arrays

parent 87ac58f4
...@@ -82,7 +82,9 @@ const processAnyType = (anyType, methodSpecs) => { ...@@ -82,7 +82,9 @@ const processAnyType = (anyType, methodSpecs) => {
}, {}); }, {});
return distilled; return distilled;
}); });
return reduced;
const result = methodSpecs.returnType === false && reduced.length === 1 ? reduced[0] : reduced; // Only return an array if necessary
return result;
}; };
const parseResponse = exports.parseResponse = (rawResult, methodSpecs) => { const parseResponse = exports.parseResponse = (rawResult, methodSpecs) => {
......
...@@ -79,7 +79,9 @@ const processAnyType = (anyType, methodSpecs) => { ...@@ -79,7 +79,9 @@ const processAnyType = (anyType, methodSpecs) => {
}, {}); }, {});
return distilled; return distilled;
}); });
return reduced;
const result = methodSpecs.returnType === false && reduced.length === 1 ? reduced[0] : reduced; // Only return an array if necessary
return result;
}; };
export const parseResponse = (rawResult, methodSpecs) => { export const parseResponse = (rawResult, methodSpecs) => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment