MCPcopy Index your code
hub / github.com/nodejs/node-addon-api / CanUnWrap

Method CanUnWrap

test/objectwrap.cc:60–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58 }
59
60 static Napi::Value CanUnWrap(const Napi::CallbackInfo& info) {
61 Napi::Object wrappedObject = info[0].As<Napi::Object>();
62 std::string expectedString = info[1].As<Napi::String>();
63 Test* nativeObject = Test::Unwrap(wrappedObject);
64 std::string strVal = MaybeUnwrap(nativeObject->Getter(info).ToString());
65
66 return Napi::Boolean::New(info.Env(), strVal == expectedString);
67 }
68
69 void Setter(const Napi::CallbackInfo& /*info*/, const Napi::Value& value) {
70 value_ = MaybeUnwrap(value.ToString());

Callers

nothing calls this directly

Calls 3

MaybeUnwrapFunction · 0.85
EnvMethod · 0.80
GetterMethod · 0.45

Tested by

no test coverage detected