diff --git a/package-lock.json b/package-lock.json index 66f1845..19957e4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1657,9 +1657,9 @@ } }, "node_modules/path-to-regexp": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.2.tgz", - "integrity": "sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", + "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==", "dev": true }, "node_modules/pathval": { diff --git a/src/CodeService.js b/src/CodeService.js index 4db29a3..5fdeddc 100644 --- a/src/CodeService.js +++ b/src/CodeService.js @@ -233,8 +233,20 @@ function extractSetOfValueSetsFromLibrary( extractFromIncluded = true, valueSets = new Set() ) { - // First add all the value sets from this library into the set - Object.values(library.valuesets).forEach(vs => valueSets.add(vs)); + // Some JSON-ELM use the "valueSets" property, while others use the "valuesets" property + // First, check if library has "valueSets" property or "valuesets" property + if (library.valueSets == null && library.valuesets == null) { + return valueSets; + } + + // Extract the arrays of the "valueSets" property and "valuesets" property + let valueSetsInLibrary = library.valueSets ? Object.values(library.valueSets)[0] : []; + let valuesetsInLibrary = library.valuesets ? Object.values(library.valuesets)[0] : []; + + // Add all the value sets from this library into the set + valueSetsInLibrary.forEach(vs => valueSets.add(vs)); + valuesetsInLibrary.forEach(vs => valueSets.add(vs)); + // Then, if requested, loop through the included libraries and add value sets from each of them if (extractFromIncluded && library.includes) { Object.values(library.includes).forEach(included =>