I'm trying to access a known object and get one of its properties as a Number
Unfortunately, the following code...
Isolate *isolate = args.GetIsolate();
Local<Object> opts = args[0]->ToObject();
Local<Number> mode = opts->Get(String::NewFromUtf8(isolate, "mode"))->ToNumber();
is giving the following warning:
warning C4996: 'v8::Value::ToNumber': was declared deprecated
....node-gyp\8.5.0\include\node\v8.h(9578): note: see declaration of 'v8::Value::ToNumber'
In the v8.h I noticed the comment on ToNumber
: "Use maybe version". I've attempted to convert it to a Maybe
but I've not yet been able to get any attempt to compile correctly. What is the correct approach to using Maybe
and getting the Number
object?
Looks like the "Use maybe version" comment in the v8.h
led me in the wrong direction. The deprecate notice seems to apply to the method-overload that is missing the isolate. If you pass the isolate...
->ToNumber(isolate);
it works without warning.