/********************************************************************* * NAN - Native Abstractions for Node.js * * Copyright (c) 2018 NAN contributors * * MIT License ********************************************************************/ #include NAN_METHOD(Parse) { Nan::JSON NanJSON; Nan::MaybeLocal inp = Nan::To(info[0]); if (!inp.IsEmpty()) { Nan::MaybeLocal result = NanJSON.Parse( inp.ToLocalChecked() ); if (!result.IsEmpty()) { info.GetReturnValue().Set(result.ToLocalChecked()); } } } NAN_MODULE_INIT(Init) { Nan::Set(target , Nan::New("parse").ToLocalChecked() , Nan::GetFunction(Nan::New(Parse)).ToLocalChecked() ); } NODE_MODULE(parse, Init)