Skip to content

Commit

Permalink
Fix not()
Browse files Browse the repository at this point in the history
  • Loading branch information
projkov committed Dec 20, 2023
1 parent 233e41b commit 0fdbce4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fhirpathpy/engine/invocations/existence.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from decimal import Decimal
from fhirpathpy.engine.invocations.misc import to_boolean
import fhirpathpy.engine.util as util
import fhirpathpy.engine.nodes as nodes
import fhirpathpy.engine.invocations.filtering as filtering
Expand All @@ -20,6 +21,11 @@ def count_fn(ctx, value):
return 0


# engine.notFn = function(coll) {
# let d = misc.singleton(coll, 'Boolean');
# return (typeof (d) === 'boolean') ? !d : [];
# };

def not_fn(ctx, x):
if len(x) != 1:
return []
Expand All @@ -29,7 +35,7 @@ def not_fn(ctx, x):
if type(data) == bool:
return not data

return []
return not to_boolean(ctx, x)


def exists_macro(ctx, coll, expr=None):
Expand Down

0 comments on commit 0fdbce4

Please sign in to comment.