MCPcopy Create free account
hub / github.com/nodejs/nan / NAN_METHOD

Function NAN_METHOD

test/cpp/json-parse.cpp:11–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9#include <nan.h>
10
11NAN_METHOD(Parse) {
12 Nan::JSON NanJSON;
13
14 Nan::MaybeLocal<v8::String> inp = Nan::To<v8::String>(info[0]);
15
16 if (!inp.IsEmpty()) {
17 Nan::MaybeLocal<v8::Value> result = NanJSON.Parse(
18 inp.ToLocalChecked()
19 );
20
21 if (!result.IsEmpty()) {
22 info.GetReturnValue().Set(result.ToLocalChecked());
23 }
24 }
25}
26
27NAN_MODULE_INIT(Init) {
28 Nan::Set(target

Callers

nothing calls this directly

Calls 5

ParseMethod · 0.80
ToLocalCheckedMethod · 0.80
IsEmptyMethod · 0.45
SetMethod · 0.45
GetReturnValueMethod · 0.45

Tested by

no test coverage detected