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

Function SetComponent

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

Source from the content-addressed store, hash-verified

273}
274
275void SetComponent(v8::Isolate *isolate, const v8::Local<v8::Object> &object,
276 const std::string &componentKey, const url_pattern_component_result &component) {
277 auto ctx = isolate->GetCurrentContext();
278 auto ret = v8::Object::New(isolate);
279 ret->Set(
280 ctx, ArgConverter::ConvertToV8String(isolate, "input"),
281 ArgConverter::ConvertToV8String(isolate, component.input)
282 );
283
284 auto groupValue = v8::Object::New(isolate);
285
286
287 for (const auto &[key, value]: component.groups) {
288 if (value) {
289 groupValue->Set(
290 ctx, ArgConverter::ConvertToV8String(isolate, key),
291 ArgConverter::ConvertToV8String(isolate, value.value())
292 );
293 } else {
294 groupValue->Set(
295 ctx, ArgConverter::ConvertToV8String(isolate, key),
296 v8::Undefined(isolate)
297 );
298 }
299
300 }
301
302
303 ret->Set(
304 ctx, ArgConverter::ConvertToV8String(isolate, "groups"),
305 groupValue
306 );
307
308 object->Set(
309 ctx, ArgConverter::ConvertToV8String(isolate, componentKey),
310 ret
311 );
312}
313
314void BuildJS(v8::Isolate *isolate, const v8::Local<v8::Object> &object,
315 const url_pattern_result &result) {

Callers 1

BuildJSFunction · 0.85

Calls 3

NewFunction · 0.85
valueMethod · 0.80
SetMethod · 0.45

Tested by

no test coverage detected