Skip to content

Commit

Permalink
fix(merge): updates MergeAppend function for booleans with False values
Browse files Browse the repository at this point in the history
Fixes #248 and #250

Signed-off-by: Emin Aktas <[email protected]>
  • Loading branch information
eminaktas committed Oct 20, 2024
1 parent 3599253 commit c1b1895
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions merge/main.k
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ schema MergeAppend[a, b]:
).value => {"a": 6, "b": {"c": 7, "d": 3, "f": 8}, "e": [4, 5, 6, 7]}
"""
value?: {str:} = {
k: [*v, *b[k]] if typeof(v) == "list" and typeof(b[k]) == "list" else v | b[k] \
if typeof(v) == typeof(b[k]) and typeof(v) not in ["str", "bool", "int", "float"] else b[k] or v \
k: [*v, *b[k]] if typeof(v) == "list" and typeof(b[k]) == "list" else v if typeof(b[k]) == "UndefinedType" else MergeAppend(v, b[k]).value \
if typeof(v) == typeof(b[k]) and typeof(v) not in ["str", "bool", "int", "float"] else b[k] if b[k] is not None else v \
for k, v in a
} | {k: v for k, v in b if not a[k]}

Expand Down

0 comments on commit c1b1895

Please sign in to comment.