Function rustyscript::validate

source ·
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, or an error if something went wrong.

Example

assert!(rustyscript::validate("5 + 5").expect("Something went wrong!"));