From 190bc3b3c46f20f9d862c287856d7062baabeaa4 Mon Sep 17 00:00:00 2001 From: Ning Sun Date: Mon, 18 Nov 2024 10:14:38 +0800 Subject: [PATCH] fix: compare helpers --- src/helpers/helper_extras.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/helpers/helper_extras.rs b/src/helpers/helper_extras.rs index b464ad05e..21ece3013 100644 --- a/src/helpers/helper_extras.rs +++ b/src/helpers/helper_extras.rs @@ -11,9 +11,9 @@ use crate::json::value::JsonTruthy; handlebars_helper!(eq: |x: Json, y: Json| x == y); handlebars_helper!(ne: |x: Json, y: Json| x != y); handlebars_helper!(gt: |x: Json, y: Json| compare_json(x, y) == Some(Ordering::Greater)); -handlebars_helper!(gte: |x: Json, y: Json| compare_json(x, y) == Some(Ordering::Less)); +handlebars_helper!(gte: |x: Json, y: Json| compare_json(x, y).is_some_and(|ord| ord != Ordering::Less)); handlebars_helper!(lt: |x: Json, y: Json| compare_json(x, y) == Some(Ordering::Less)); -handlebars_helper!(lte: |x: Json, y: Json| compare_json(x, y) == Some(Ordering::Greater)); +handlebars_helper!(lte: |x: Json, y: Json| compare_json(x, y).is_some_and(|ord| ord != Ordering::Greater)); handlebars_helper!(and: |x: Json, y: Json| x.is_truthy(false) && y.is_truthy(false)); handlebars_helper!(or: |x: Json, y: Json| x.is_truthy(false) || y.is_truthy(false)); handlebars_helper!(not: |x: Json| !x.is_truthy(false));