node-addon-examples
node-addon-examples copied to clipboard
Nan conversion of external type
Have a piece of code, that works on node <12, but will need to be converted to for node 12.
return static_cast<ext2_filsys>(
info[0]->ToObject().As<v8::External>()->Value()
);
I couldn't see any examples for v8::External in conversion (i.e. I'm guessing using it with Nan::To<v8::Object>?)
What would be an example of using such v8::External cases?
Resolved it with this form, but feels like I might be mixing stuff here quote a bit.
return static_cast<ext2_filsys>(
Nan::To<v8::Object>(info[0]).ToLocalChecked().As<v8::External>()->Value()
);
@imrehg we are mostly maintaining the napi/node-addon-api examples. Sounds like you may have already answered your own question anyway.