javascript: handle arrays correctly in FFI