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

Method valueToBool

valdi/src/valdi/v8/V8JavaScriptContext.cpp:806–823  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

804 if (!exceptionTracker) {
805 return nullptr;
806 }
807 v8::Local<v8::Context> context = v8::Local<v8::Context>::New(_isolate, _context);
808 v8::Local<v8::String> string;
809 if (!val->ToString(context).ToLocal(&string)) {
810 exceptionTracker.onError("Failed to convert value to static string");
811 return nullptr;
812 }
813
814 const int length = string->Utf8Length(_isolate);
815 Ref<StaticString> str = StaticString::makeUTF8(length);
816 string->WriteUtf8(_isolate, str->utf8Data(), length);
817
818 return str;
819}
820
821bool V8JavaScriptContext::valueToBool(const JSValue& value, JSExceptionTracker& exceptionTracker) {
822 v8::HandleScope handleScope(_isolate);
823
824 auto val_ = fromValdiJSValue(_isolate, value, exceptionTracker);
825 if (!exceptionTracker) {
826 return false;

Callers 2

marshallMethod · 0.45
mainFunction · 0.45

Calls 1

fromValdiJSValueFunction · 0.70

Tested by

no test coverage detected