Skip to content

Commit

Permalink
Confirm items is array before attempting to pull length or map in gra…
Browse files Browse the repository at this point in the history
…phqlParser
  • Loading branch information
ryanhefner committed Oct 7, 2020
1 parent 5968abe commit ba2a305
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/parsers/graphqlParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ export function graphqlParser(rootKey, data, definitionMap, props = { include: 1
// @todo Add `limit` to response object - Ryan
return {
__typename: typename,
total: (items || []).length,
items: (items || []).map(
total: (items && Array.isArray(items) ? items : []).length,
items: (items && Array.isArray(items) ? items : []).map(
item => parseEntry(item, definitionMap?.items, depth)
)
.filter(item => !!item),
Expand Down

0 comments on commit ba2a305

Please sign in to comment.