Skip to content

Commit

Permalink
Merge pull request #48 in LFOR/fhirpath.js from feature/LF-2344/api-f…
Browse files Browse the repository at this point in the history
…unction-types to master

* commit 'ae850d6ac1a95f091cead06378552c28921e8279':
  npm audit fix
  Fixed issues found during review
  Fixed issues found during review
  Minor changes
  Fixed expression evaluation on a result of the previous evaluation
  Fixed a comment
  Fixed issues found during review
  Add a types() function to the fhirpath.js API
  • Loading branch information
yuriy-sedinkin committed Dec 6, 2022
2 parents 52ba44c + ae850d6 commit 28eccf0
Show file tree
Hide file tree
Showing 11 changed files with 588 additions and 1,094 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
This log documents significant changes for each release. This project follows
[Semantic Versioning](http://semver.org/).

## [3.3.0] - 2022-11-21
### Added
- An API method `types` which returns the type of each element in FHIRPath result
array which was obtained from `evaluate()` with option `resolveInternalTypes=false`.
### Fixed
- The hidden (non-enumerable) property `__path__` has been moved from the entire
array of result values to each element of the array, because the result array
may contain items of different types.
- The type of `today()` was defined as `System.DateTime`. Now it is defined as
`System.Date`.

## [3.2.0] - 2022-10-28
### Added
- Functions: toDate(), convertsToDate().
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@ standard JavaScript types you can use the special function "resolveInternalTypes
const res = fhirpath.resolveInternalTypes(value);
```
Also, there is a special API function to get the type of each element in FHIRPath
result array which was obtained from evaluate() (unless you resolve the internal
types). This function returns an array of strings.
In the next example, `res` will have a value like this:
['FHIR.dateTime', 'FHIR.string', ...].
```js
const res = fhirpath.types(
fhirpath.evaluate(resource, expression, context, model, {resolveInternalTypes: false})
);
```
## fhirpath CLI
Expand Down
Loading

0 comments on commit 28eccf0

Please sign in to comment.