MCPcopy Create free account
hub / github.com/NodeRT/NodeRT / First

Method First

src/NodeRTLib/ProjectFiles/CollectionsWrap.h:426–455  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

424 }
425
426 static void First(Nan::NAN_METHOD_ARGS_TYPE info) {
427 HandleScope scope;
428
429 if (!NodeRT::Utils::IsWinRtWrapperOf<
430 ::Windows::Foundation::Collections::IIterable<T> ^>(info.This())) {
431 return;
432 }
433
434 IterableWrapper<T>* wrapper =
435 IterableWrapper<T>::Unwrap<IterableWrapper<T>>(info.This());
436
437 if (info.Length() == 0) {
438 try {
439 ::Windows::Foundation::Collections::IIterator<T> ^ result =
440 wrapper->_instance->First();
441
442 info.GetReturnValue().Set(IteratorWrapper<T>::CreateIteratorWrapper(
443 result, wrapper->_getterFunc));
444 } catch (Platform::Exception ^ exception) {
445 NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
446 return;
447 }
448 } else {
449 Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(
450 L"Bad arguments: no suitable overload found")));
451 return;
452 }
453
454 return;
455 }
456
457 private:
458 ::Windows::Foundation::Collections::IIterable<T> ^ _instance;

Callers

nothing calls this directly

Calls 3

NewStringFunction · 0.85
FirstMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected