| 490 | } |
| 491 | |
| 492 | if (output.isUndefined()) { |
| 493 | // No proxy objects found in the object, marshall as a plain map |
| 494 | return untypedJsObjectToValue(jsContext, jsValue, referenceInfoBuilder, exceptionTracker); |
| 495 | } else { |
| 496 | // Proxy object found, return it |
| 497 | return output; |
| 498 | } |
| 499 | } |
| 500 | |
| 501 | size_t jsArrayGetLength(IJavaScriptContext& jsContext, const JSValue& jsValue, JSExceptionTracker& exceptionTracker) { |
| 502 | static auto kLength = STRING_LITERAL("length"); |
| 503 | |
| 504 | auto length = jsContext.getObjectProperty(jsValue, jsContext.getPropertyNameCached(kLength), exceptionTracker); |
| 505 | if (!exceptionTracker) { |
| 506 | return 0; |
| 507 | } |
| 508 | |
| 509 | return static_cast<size_t>(jsContext.valueToInt(length.get(), exceptionTracker)); |
| 510 | } |
| 511 | |
| 512 | Value jsArrayToValue(IJavaScriptContext& jsContext, |
| 513 | const JSValue& jsValue, |
| 514 | const ReferenceInfoBuilder& referenceInfoBuilder, |
| 515 | JSExceptionTracker& exceptionTracker) { |
| 516 | auto arrayLength = jsArrayGetLength(jsContext, jsValue, exceptionTracker); |
| 517 | if (!exceptionTracker) { |
| 518 | return Value::undefined(); |
| 519 | } |
| 520 | |
| 521 | auto array = Valdi::ValueArray::make(arrayLength); |
| 522 |
no test coverage detected