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

Function GetCastedFromGetter

test/object_reference.cc:360–374  ·  view source on GitHub ↗

info[0] is a flag to determine if the weak, persistent, or multiple reference ObjectReference is being requested. info[1] is the key and it must be a Number.

Source from the content-addressed store, hash-verified

358// multiple reference ObjectReference is being requested.
359// info[1] is the key and it must be a Number.
360Value GetCastedFromGetter(const CallbackInfo& info) {
361 Env env = info.Env();
362
363 if (info[0] == String::New(env, "weak")) {
364 if (casted_weak.IsEmpty()) {
365 return String::New(env, "No Referenced Value");
366 } else {
367 return MaybeUnwrap(casted_weak.Get(info[1].As<Number>()));
368 }
369 } else if (info[0] == String::New(env, "persistent")) {
370 return MaybeUnwrap(casted_persistent.Get(info[1].As<Number>()));
371 } else {
372 return MaybeUnwrap(casted_reference.Get(info[1].As<Number>()));
373 }
374}
375
376// info[0] is a flag to determine if the weak, persistent, or
377// multiple reference ObjectReference is being requested.

Callers

nothing calls this directly

Calls 4

MaybeUnwrapFunction · 0.85
EnvMethod · 0.80
IsEmptyMethod · 0.80
GetMethod · 0.80

Tested by

no test coverage detected