MCPcopy Create free account
hub / github.com/Distributive-Network/PythonMonkey / JSObjectProxy_contains

Method JSObjectProxy_contains

src/JSObjectProxy.cc:167–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165}
166
167int JSObjectProxyMethodDefinitions::JSObjectProxy_contains(JSObjectProxy *self, PyObject *key)
168{
169 JS::RootedId id(GLOBAL_CX);
170 if (!keyToId(key, &id)) {
171 PyErr_SetString(PyExc_AttributeError, "JSObjectProxy property name must be of type str or int");
172 return -1;
173 }
174 JS::RootedValue value(GLOBAL_CX);
175 JS_GetPropertyById(GLOBAL_CX, *(self->jsObject), id, &value);
176 return value.isUndefined() ? 0 : 1;
177}
178
179static inline void assignKeyValue(JSObjectProxy *self, PyObject *key, JS::HandleId id, PyObject *value) {
180 if (value) { // we are setting a value

Callers

nothing calls this directly

Calls 1

keyToIdFunction · 0.85

Tested by

no test coverage detected