Skip to content

Commit

Permalink
fix: resolved comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ShubhranshuSanjeev committed Jan 9, 2025
1 parent b734e78 commit 865561f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/frontend/src/logic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ pub enum Expression {
}

pub fn is_variable(v: &serde_json::Value) -> bool {
v.is_object() && v.as_object().unwrap().contains_key("var")
v.is_object()
&& v.as_object()
.map(|v| v.contains_key("var"))
.unwrap_or_default()
}

pub fn is_constant(v: &serde_json::Value) -> bool {
Expand All @@ -33,7 +36,7 @@ impl Expression {
.cloned()
.ok_or("Invalid operands list for context")?;

let operand_0 = operands.first();
let operand_0 = operands.get(0);
let operand_1 = operands.get(1);
let operand_2 = operands.get(2);

Expand Down Expand Up @@ -176,6 +179,9 @@ impl From<(SchemaType, Operator)> for Expression {
}
}

/// The `Operator` enum is just a marker to helps dynamically determine the
/// type of input field to render and the appropriate parsing logic to
/// apply based on the operator type.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub enum Operator {
Is,
Expand Down

0 comments on commit 865561f

Please sign in to comment.