MCPcopy Create free account
hub / github.com/nodejs/node-addon-api / CreateObjectUsingMagic

Function CreateObjectUsingMagic

test/object/object.cc:294–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292}
293
294Value CreateObjectUsingMagic(const CallbackInfo& info) {
295 Env env = info.Env();
296 Object obj = Object::New(env);
297 obj["cp_false"] = false;
298 obj["cp_true"] = true;
299 obj[std::string("s_true")] = true;
300 obj[std::string("s_false")] = false;
301 obj["0"] = 0;
302 obj[(uint32_t)42] = 120;
303 obj["0.0f"] = 0.0f;
304 obj["0.0"] = 0.0;
305 obj["-1"] = -1;
306 obj["foo2"] = u"foo";
307 obj[std::string("foo4")] = NAPI_WIDE_TEXT("foo");
308 obj[std::string("foo5")] = "foo";
309 obj[std::string("foo6")] = std::u16string(NAPI_WIDE_TEXT("foo"));
310 obj[std::string("foo7")] = std::string("foo");
311 obj[std::string("circular")] = obj;
312 obj["circular2"] = obj;
313 return obj;
314}
315
316#ifdef NAPI_CPP_EXCEPTIONS
317Value Sum(const CallbackInfo& info) {

Callers

nothing calls this directly

Calls 1

EnvMethod · 0.80

Tested by

no test coverage detected