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

Method HasKey

src/NodeRTLib/ProjectFiles/CollectionsWrap.h:1732–1761  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1730 }
1731
1732 static void HasKey(Nan::NAN_METHOD_ARGS_TYPE info) {
1733 HandleScope scope;
1734
1735 if (!NodeRT::Utils::IsWinRtWrapperOf<
1736 ::Windows::Foundation::Collections::IMap<K, V> ^>(info.This())) {
1737 return;
1738 }
1739
1740 MapWrapper<K, V>* wrapper =
1741 MapWrapper<K, V>::Unwrap<MapWrapper<K, V>>(info.This());
1742
1743 if (info.Length() == 1 && wrapper->_checkKeyTypeFunc(info[0])) {
1744 try {
1745 K key = wrapper->_convertToKeyTypeFunc(info[0]);
1746
1747 bool result = wrapper->_instance->HasKey(key);
1748
1749 info.GetReturnValue().Set(Nan::New<Boolean>(result));
1750 } catch (Platform::Exception ^ exception) {
1751 NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
1752 return;
1753 }
1754 } else {
1755 Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(
1756 L"Bad arguments: no suitable overload found")));
1757 return;
1758 }
1759
1760 return;
1761 }
1762
1763 static void Remove(Nan::NAN_METHOD_ARGS_TYPE info) {
1764 HandleScope scope;

Callers 1

HasKeyMethod · 0.45

Calls 2

NewStringFunction · 0.85
SetMethod · 0.45

Tested by

no test coverage detected