Skip to content

Commit

Permalink
Move all logic inside match statement
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrattli committed Nov 28, 2023
1 parent 51e0842 commit b00beae
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/fable-library-py/fable_library/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,25 +217,20 @@ class DateKind(IntEnum):


def equals(a: Any, b: Any) -> bool:
if a is b:
return True

# Check for NoneTypes (ex Some [1] = None)
match (a, b):
case (a, b) if a is b:
return True
# Don't test (None, None) here, because a is b already covers that
# case (None, None):
# return True
case (None, _):
return False
case (_, None):
return False
case (_, _):
pass

if is_array_like(a):
return equal_arrays(a, b)

return a == b
case (a, b) if is_array_like(a):
return equal_arrays(a, b)
case _:
return a == b


def is_comparable(x: Any) -> bool:
Expand Down

0 comments on commit b00beae

Please sign in to comment.