MCPcopy Create free account
hub / github.com/Snapchat/Valdi / jsObjectToValue

Function jsObjectToValue

valdi/src/valdi/runtime/JavaScript/JavaScriptUtils.cpp:457–479  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

455
456void throwInvalidType(IJavaScriptContext& jsContext,
457 const JSValue& jsValue,
458 JSExceptionTracker& exceptionTracker,
459 ValueType expectedType) {
460 exceptionTracker.onError(Value::invalidTypeError(expectedType, jsContext.getValueType(jsValue)));
461}
462
463Value untypedJsObjectToValue(IJavaScriptContext& jsContext,
464 const JSValue& jsValue,
465 const ReferenceInfoBuilder& referenceInfoBuilder,
466 JSExceptionTracker& exceptionTracker) {
467 ObjectConvertVisitor visitor(referenceInfoBuilder);
468 jsContext.visitObjectPropertyNames(jsValue, exceptionTracker, visitor);
469
470 if (!exceptionTracker) {
471 return Value::undefined();
472 }
473
474 return Value(visitor.convertedObject);
475}
476
477Value jsObjectToValue(IJavaScriptContext& jsContext,
478 const JSValue& jsValue,
479 const ReferenceInfoBuilder& referenceInfoBuilder,
480 JSExceptionTracker& exceptionTracker) {
481 auto* valueMarshaller = jsContext.getValueMarshaller();
482

Callers 1

jsValueToValueFunction · 0.85

Calls 4

untypedJsObjectToValueFunction · 0.85
tryUnwrapMethod · 0.80
getValueMarshallerMethod · 0.45
isUndefinedMethod · 0.45

Tested by

no test coverage detected