tamaki.mes.backup.compare.equalValues
Description
Compares two scalar values for equality with some tolerance for numbers:
- If both values are numeric, they are considered equal when
isClosereports them close. - Otherwise the function attempts to coerce both values to floats and compare them with
isClose(so"1.0"and1compare equal). - If coercion fails and the values are of different types, they are not equal.
- Otherwise standard equality (
==) is used.
This function is intended for scalar values and does not compare lists or dictionaries well.
Syntax
tamaki.mes.backup.compare.equalValues(oldValue, newValue)
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
oldValue | Object | True | The first value. |
newValue | Object | True | The second value. |
Returns
A Boolean: True if the values are considered equal, otherwise False.
Code Examples
print(tamaki.mes.backup.compare.equalValues("1.0", 1)) # True
print(tamaki.mes.backup.compare.equalValues("a", "b")) # False