Skip to main content

JS_DetectModule

Function JS_DetectModule 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn JS_DetectModule( input: *const c_char, input_len: usize, ) -> Bool
Expand description

JS_DetectModule: whether input parses as a module rather than a script.

Decided by the same rule the reference uses: try the module grammar, and a success means module. The engine’s parser exposes only a script entry point here, so the test is “does it contain a top-level import/export”, which is what distinguishes the two grammars for source that has no syntax error either way.

§Safety

input must point at input_len readable bytes.