Skip to main content

values_equal

Function values_equal 

Source
pub fn values_equal(left: &Value, right: &Value) -> EvalResult<bool>
Expand description

Check if two values are equal under == (string equality in [[ ]]).

Same-type comparisons stay typed: Int↔Int, Float↔Float (with epsilon), Int↔Float (numeric across the kaish number axis), Json deep equality, Blob by id. For everything else — including mixed String/Number — we stringify both sides and compare. That matches bash’s “everything is a string in [[ a == b ]]” model and avoids the prior asymmetry where [[ "01" == 1 ]] returned true via parse-as-int while [[ "01" == "1" ]] returned false. Users wanting numeric equality across stringified numbers should use -eq, which coerces via numeric_compare.