MCPcopy Create free account
hub / github.com/NativeScript/android / BuildJS

Function BuildJS

test-app/runtime/src/main/cpp/URLPatternImpl.cpp:314–348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

312}
313
314void BuildJS(v8::Isolate *isolate, const v8::Local<v8::Object> &object,
315 const url_pattern_result &result) {
316 auto ctx = isolate->GetCurrentContext();
317
318 auto len = result.inputs.size();
319 auto inputs = v8::Array::New(isolate, len);
320 for (int i = 0; i < len; i++) {
321 auto item = result.inputs[i];
322
323 if (std::holds_alternative<std::string_view>(item)) {
324 auto view = std::get<std::string_view>(item);
325 if (view.empty()) {
326 inputs->Set(ctx, i, v8::String::Empty(isolate));
327 } else {
328 inputs->Set(ctx, i, ArgConverter::ConvertToV8String(isolate, view.data(),
329 view.size()));
330 }
331 }
332
333 }
334
335 object->Set(
336 ctx, ArgConverter::ConvertToV8String(isolate, "inputs"),
337 inputs
338 );
339
340 SetComponent(isolate, object, "protocol", result.protocol);
341 SetComponent(isolate, object, "hash", result.hash);
342 SetComponent(isolate, object, "hostname", result.hostname);
343 SetComponent(isolate, object, "username", result.username);
344 SetComponent(isolate, object, "password", result.password);
345 SetComponent(isolate, object, "pathname", result.pathname);
346 SetComponent(isolate, object, "port", result.port);
347 SetComponent(isolate, object, "search", result.search);
348}
349
350
351void URLPatternImpl::Ctor(const v8::FunctionCallbackInfo<v8::Value> &args) {

Callers 1

ExecMethod · 0.85

Calls 6

NewFunction · 0.85
SetComponentFunction · 0.85
sizeMethod · 0.45
emptyMethod · 0.45
SetMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected