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

Method First

src/NodeRTLib/ProjectFiles/CollectionsWrap.h:1823–1864  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1821 }
1822
1823 static void First(Nan::NAN_METHOD_ARGS_TYPE info) {
1824 HandleScope scope;
1825
1826 if (!NodeRT::Utils::IsWinRtWrapperOf<
1827 ::Windows::Foundation::Collections::IMap<K, V> ^>(info.This())) {
1828 return;
1829 }
1830
1831 MapWrapper<K, V>* wrapper =
1832 MapWrapper<K, V>::Unwrap<MapWrapper<K, V>>(info.This());
1833
1834 if (info.Length() == 0) {
1835 try {
1836 const std::function<Local<Value>(K)>& keyGetter =
1837 wrapper->_keyGetterFunc;
1838 const std::function<Local<Value>(V)>& valueGetter =
1839 wrapper->_valueGetterFunc;
1840 info.GetReturnValue().Set(
1841 IteratorWrapper<
1842 ::Windows::Foundation::Collections::IKeyValuePair<K, V> ^>::
1843 CreateIteratorWrapper(
1844 wrapper->_instance->First(),
1845 [keyGetter, valueGetter](
1846 ::Windows::Foundation::Collections::IKeyValuePair<K,
1847 V> ^
1848 value) {
1849 return KeyValuePairWrapper<
1850 K, V>::CreateKeyValuePairWrapper(value, keyGetter,
1851 valueGetter);
1852 }));
1853 } catch (Platform::Exception ^ exception) {
1854 NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
1855 return;
1856 }
1857 } else {
1858 Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(
1859 L"Bad arguments: no suitable overload found")));
1860 return;
1861 }
1862
1863 return;
1864 }
1865
1866 static void Lookup(Nan::NAN_METHOD_ARGS_TYPE info) {
1867 HandleScope scope;

Callers 9

FirstMethod · 0.45
FirstMethod · 0.45
FirstMethod · 0.45
FirstMethod · 0.45

Calls 2

NewStringFunction · 0.85
SetMethod · 0.45

Tested by

no test coverage detected