pub fn validate(javascript: &str) -> Result<bool, Error>
Expand description
Validates the syntax of some JS
§Arguments
javascript
- A snippet of JS code
§Returns
A Result
containing a boolean determining the validity of the JS
§Errors
Will return an error if the runtime cannot be started (usually due to extension issues)
Or if something went wrong and the validity could not be determined
§Example
assert!(rustyscript::validate("5 + 5").expect("Something went wrong!"));