Skip to content

Commit

Permalink
#7: add optional chaining
Browse files Browse the repository at this point in the history
  • Loading branch information
mohit-s96 committed Nov 3, 2023
1 parent 3c75f4f commit 94f2a2e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const getMetadata = (version = CURRENT_DD_VERSION) =>
* @returns The standard lookup map computed from the RESO metadata report for the version that is provided.
*/
const getLookupMap = (version = CURRENT_DD_VERSION) =>
getMetadata(version).lookups.reduce((acc, { lookupName, lookupValue, annotations }) => {
getMetadata(version)?.lookups?.reduce((acc, { lookupName, lookupValue, annotations }) => {
const parsedLookupName = lookupName?.substring(lookupName?.lastIndexOf('.') + 1);
const annotationMap = buildAnnotationMap(annotations);

Expand All @@ -79,7 +79,7 @@ const getStandardMetadata = (version = CURRENT_DD_VERSION) => {
const annotationMap = buildAnnotationMap(field?.annotations);
const url = annotationMap[DD_WIKI_URL_TERM];

const type = field.type.startsWith('Edm.') ? field.type : 'Edm.EnumType';
const type = field?.type?.startsWith('Edm.') ? field.type : 'Edm.EnumType';

const transformedField = {
resourceName: field.resourceName,
Expand Down

0 comments on commit 94f2a2e

Please sign in to comment.