Check equality with type coercion. Handles `"5" == 5` by coercing both sides to f64 when one is a number and the other is a numeric string.
(a: &serde_json::Value, b: &serde_json::Value)
| 55 | /// Handles `"5" == 5` by coercing both sides to f64 when one is a |
| 56 | /// number and the other is a numeric string. |
| 57 | pub fn coerced_eq(a: &serde_json::Value, b: &serde_json::Value) -> bool { |
| 58 | if a == b { |
| 59 | return true; |
| 60 | } |
| 61 | if let (Some(af), Some(bf)) = (json_to_f64(a, true), json_to_f64(b, true)) { |
| 62 | return (af - bf).abs() < f64::EPSILON; |
| 63 | } |
| 64 | false |
| 65 | } |
| 66 | |
| 67 | /// Check if a JSON value is truthy (for boolean contexts). |
| 68 | /// |
no test coverage detected