Skip to main content

default_evaluate

Function default_evaluate 

Source
pub fn default_evaluate(response: &JsonValue) -> bool
Expand description

The default approval test of a Confirm: true, or "y"/"yes" (case-insensitive, trimmed of Unicode whitespace other than U+0085, plus U+FEFF).

use serde_json::json;
use strands::interventions::default_evaluate;

assert!(default_evaluate(&json!(true)));
assert!(default_evaluate(&json!(" YES ")));
assert!(!default_evaluate(&json!("no")));