| 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; |
no test coverage detected