hasPropertyForKey method

bool hasPropertyForKey(
  1. String propertyKey
)

Tests whether an object has a given property using a JSValueRef as the property key. // iOS 13.0 This function is the same as performing "propertyKey in object" from JavaScript. propertyKey A JSValueRef containing the property key to use when looking up the property. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.

Implementation

bool hasPropertyForKey(String propertyKey) {
  final JSException exception = JSException.create(context);
  final JSValue jspropKey = JSValue.makeString(context, propertyKey);
  final bool ret = JSObjectHasPropertyForKey(
    context.ref,
    _ref,
    jspropKey.ref,
    exception.ref,
  );
  if (exception.shouldThrow) throw exception.error;
  return ret;
}