Skip to main content

construct_typed_array

Function construct_typed_array 

Source
pub fn construct_typed_array(
    interp: &mut Interp<'static>,
    element: ElementType,
    args: Vec<Value>,
) -> JsResult<Value>
Expand description

new Uint8Array(...) and friends, from decoded arguments.

Three argument shapes, exactly as the constructor has them: a length, an iterable or array-like, or (buffer, byteOffset, length). Rather than reimplement the distinctions, this calls the realm’s constructor with the arguments C supplied — which is also what makes a wrong argument a TypeError from the same code a script would hit.