# BREP_script_core โ a small, bounded JavaScript call on Boa
Part of the [next.BREP.io](https://next.brep.io) Rust B-rep kernel: `cargo add BREP_script_core` ยท [licence summary](#licence)
`BREP_script_core` runs one JavaScript file on the pure-Rust
[Boa](https://crates.io/crates/boa_engine) engine, calls one global function
with one JSON argument, and hands back the function's JSON result or a
message a person can read. It is the interpreter behind the BREP PLM server's
administrator hooks and the BREP CAD application's scripts, natively and in
the browser (`wasm32-unknown-unknown`).
It is for a host that wants user-written rules โ "what number does this part
get", "may this revision be released" โ without giving the script anything
the host did not hand it. The crate depends on Boa and `serde_json` only: no
file system, no network, no clock. Every binding that reaches outside the
interpreter is installed by the host.
## Example
```rust
use brep_script_core::{call, Failure};
use serde_json::json;
let source = r#"
function onRelease(part) {
console.log("checking " + part.number);
if (!part.description) throw new Error("a released part needs a description");
return { ok: true, revision: part.revision + 1 };
}
"#;
// No host bindings beyond `console`: pass an `install` that adds nothing.
let input = json!({"number": "P-100", "revision": 1, "description": "Bracket"});