pub async fn validate_expr(
        &self,
        expr: JsValue,
    ) -> Result<Option<PerspectiveValidationError>, JsValue> {
        let arr = [expr].iter().collect::<js_sys::Array>();
        let table = self.borrow().table.as_ref().unwrap().clone();
        let errors = table.validate_expressions(arr).await?.errors();
        let error_keys = js_sys::Object::keys(&errors);
        if error_keys.length() > 0 {
            let js_err = js_sys::Reflect::get(&errors, &error_keys.get(0))?;
            Ok(Some(js_err.into_serde().unwrap()))
        } else {
            Ok(None)
        }
    }
/// Validate an expression string (as a JsValue since it comes from
/// `monaco`), and marshall the results.
Validate an expression string (as a JsValue since it comes from
`monaco`), and marshall the results.
Validate an expression string ( as a JsValue since it comes from ` monaco ` ) and marshall the results .
pub async fn validate_expr(
        &self,
        expr: JsValue,
    ) -> Result<Option<PerspectiveValidationError>, JsValue> {
        let arr = [expr].iter().collect::<js_sys::Array>();
        let table = self.borrow().table.as_ref().unwrap().clone();
        let errors = table.validate_expressions(arr).await?.errors();
        let error_keys = js_sys::Object::keys(&errors);
        if error_keys.length() > 0 {
            let js_err = js_sys::Reflect::get(&errors, &error_keys.get(0))?;
            Ok(Some(js_err.into_serde().unwrap()))
        } else {
            Ok(None)
        }
    }
pub async fn validate_expr ( & self , expr : JsValue , ) -> Result < Option < PerspectiveValidationError > , JsValue > { let arr = [ expr ] . iter ( ) . collect :: < js_sys :: Array > ( ) ; let table = self . borrow ( ) . table . as_ref ( ) . unwrap ( ) . clone ( ) ; let errors = table . validate_expressions ( arr ) . await ? . errors ( ) ; let error_keys = js_sys :: Object :: keys ( & errors ) ; if error_keys . length ( ) > 0 { let js_err = js_sys :: Reflect :: get ( & errors , & error_keys . get ( 0 ) ) ? ; Ok ( Some ( js_err . into_serde ( ) . unwrap ( ) ) ) } else { Ok ( None ) } }
Validate an expression string (as a JsValue since it comes from
`monaco`), and marshall the results.
Validate an expression string ( as a JsValue since it comes from ` monaco ` ) and marshall the results .
&self
expr
JsValue
&self
expr
JsValue