In Node C++ Addon, I can return a String like this:
void Method(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
args.GetReturnValue().Set(
String::NewFromUtf8(isolate, "hello")
.ToLocalChecked()
);
}
How can I achieve the same but setting a boolean value instead of a string?
Thanks to @UnholySheep for providing links to the V8 docs.
args.GetReturnValue().Set()
has an overload the accepts abool
, so you can just pass it directly.