Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the extractSetOfValueSetsFromLibrary function in CodeService.js… #35

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions src/CodeService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 =>
Expand Down
Loading