@arkhn/fhir.ts
Advanced tools
Comparing version 3.4.0 to 3.4.1
@@ -79,2 +79,10 @@ "use strict"; | ||
var current = attributes[0], rest = attributes.slice(1); | ||
// If previous has several types but choices are not constrained, we spread them | ||
// to fill choices. | ||
// In case we reached the end of the attributes, make sure we spread the types if needed. | ||
if (previous && | ||
!(current && exports.isChoiceOf(current, previous.definition)) && | ||
previous.path.endsWith('[x]') && | ||
previous.choices.length === 0) | ||
previous.spreadTypes(); | ||
// if the list of snapshot elements is over, return the attribute list | ||
@@ -96,7 +104,2 @@ if (!current) { | ||
} | ||
if (previous.path.endsWith('[x]') && previous.choices.length === 0) { | ||
// If previous has several types but choices are not constrained, we spread them | ||
// to fill choices | ||
previous.spreadTypes(); | ||
} | ||
if (exports.isSliceOf(current, previous.definition)) { | ||
@@ -103,0 +106,0 @@ var slice = new attribute_1.Attribute(current); |
{ | ||
"name": "@arkhn/fhir.ts", | ||
"private": false, | ||
"version": "3.4.0", | ||
"version": "3.4.1", | ||
"description": "Open source typescript library providing FHIR utilities", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
import * as heartrateProfile from './fixtures/heartrate-profile.json' | ||
import * as mockDefinition from './fixtures/mockDefinition.json' | ||
import * as definitionWithSlices from './fixtures/definitionWithSlices.json' | ||
import * as patientAnimal from './fixtures/patient-animal.json' | ||
@@ -133,2 +134,11 @@ import { structurize, isChildOf } from 'definition' | ||
}) | ||
it('spread types when no choices are specified', () => { | ||
const structured = structurize(patientAnimal.resource) | ||
expect(structured.attributes).toHaveLength(3) | ||
expect(structured.attributes![0].slices).toHaveLength(3) | ||
expect(structured.attributes![2].children).toHaveLength(0) | ||
expect(structured.attributes![2].choices).toHaveLength(50) | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
544615
22
6883