Skip to content

Commit

Permalink
Merge pull request #49 in LFOR/fhirpath.js from bugfix/LF-2368/aggreg…
Browse files Browse the repository at this point in the history
…ates-init-parameters to master

* commit '5131cc6caeccaf7a21331780ee579a74294539ae':
  npm audit fix
  Version info
  unit test the aggregate function with a string init value
  #117 aggregate init function type information
  • Loading branch information
yuriy-sedinkin committed Jan 5, 2023
2 parents 28eccf0 + 5131cc6 commit b1d41e0
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 29 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
This log documents significant changes for each release. This project follows
[Semantic Versioning](http://semver.org/).

## [3.3.1] - 2022-11-22
### Fixed
- Aggregate init parameter can be any type, not just an integer.

## [3.3.0] - 2022-11-21
### Added
- An API method `types` which returns the type of each element in FHIRPath result
Expand Down
12 changes: 6 additions & 6 deletions demo/package-lock.json

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

36 changes: 15 additions & 21 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fhirpath",
"version": "3.3.0",
"version": "3.3.1",
"description": "A FHIRPath engine",
"main": "src/fhirpath.js",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/fhirpath.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ engine.invocationTable = {
where: {fn: filtering.whereMacro, arity: {1: ["Expr"]}},
extension: {fn: filtering.extension, arity: {1: ["String"]}},
select: {fn: filtering.selectMacro, arity: {1: ["Expr"]}},
aggregate: {fn: aggregate.aggregateMacro, arity: {1: ["Expr"], 2: ["Expr", "Integer"]}},
aggregate: {fn: aggregate.aggregateMacro, arity: {1: ["Expr"], 2: ["Expr", "Any"]}},
sum: {fn: aggregate.sumFn},
min: {fn: aggregate.minFn},
max: {fn: aggregate.maxFn},
Expand Down
4 changes: 4 additions & 0 deletions test/cases/7_aggregate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ tests:
expression: 10 + (1|2|3).aggregate($total + $this*$index, 4) = 22
result:
- true
- desc: 'aggregate() function with string initial value'
expression: ('a'|'b'|'c').aggregate($total & '-' & $this, 'concat')
result:
- 'concat-a-b-c'
- 'group: Extension functions':
- desc: 'sum() function calculates the sum of input collection'
expression: (1|2|3|4|5|6|7|8|9).sum() = 45
Expand Down

0 comments on commit b1d41e0

Please sign in to comment.