Skip to content

Commit

Permalink
Clean-up formatting in graphqlParser
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhefner committed Feb 19, 2021
1 parent a74fac0 commit 57104a8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/parsers/graphqlParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const capitalizeFirstLetter = (string) => {
*/
export const contentfulResolver = (fieldName, rootValue) => {
return rootValue && rootValue.hasOwnProperty(fieldName) ? rootValue[fieldName] : null
};
}

/**
* Parse Contentful Rest API response into a format that can be queried via
Expand Down Expand Up @@ -166,7 +166,7 @@ export function graphqlParser(rootKey, data, definitionMap, props = { include: 1
object.hasOwnProperty('sys') && object.hasOwnProperty('fields')
? fieldsParser(object, props, { parseArrays: false, parseRefs: false })
: object
);
)

// Parse all references and reference collections
Object.keys(objectClone).forEach(key => {
Expand Down Expand Up @@ -194,10 +194,10 @@ export function graphqlParser(rootKey, data, definitionMap, props = { include: 1
`${typename}${capitalizeFirstLetter(collectionKey)}`,
definitionMap?.[collectionKey],
depth + 1
);
)

// Delete old flat array field
delete objectClone[key];
delete objectClone[key]
} else {
objectClone[key] = field
.map((item, index) => cleanClone(item, object && object.fields && object.fields[key][index]))
Expand Down Expand Up @@ -232,7 +232,7 @@ export function graphqlParser(rootKey, data, definitionMap, props = { include: 1
const definedClone = applyDefinitions(assetClone, assetClone.__typename || typename, definitionMap)

// Return GraphQL-ready object
return definedClone;
return definedClone
}

/**
Expand All @@ -253,7 +253,7 @@ export function graphqlParser(rootKey, data, definitionMap, props = { include: 1
item => parseEntry(item, typename, definitionMap?.items, depth)
)
.filter(item => !!item),
};
}
}

// Parse collection queries
Expand Down

0 comments on commit 57104a8

Please sign in to comment.