- if (!JSValueIsObject(gContext, arguments[0]) && !JSValueIsNull(gContext, arguments[0]))
- ThrowMsg(InvalidArgumentException, "2nd argument is not object.");
+ if (JSValueIsObject(gContext, arguments[0]))
+ js1stParamIsObject = true;
+
+ if (!js1stParamIsObject &&
+ !JSValueIsNull(gContext, arguments[0]) &&
+ !JSValueIsUndefined(gContext, arguments[0]))
+ ThrowMsg(InvalidArgumentException, "1st argument must be a 'object'");