Nan 2.0, for compatibility with Node 4.0, introduced Maybe and MaybeLocal types, and several functions that return them. However, most of them do not seem to accept Maybe objects, and in several cases I would want to compose those methods. For example (assuming I have a function that returns a MaybeLocal<String>), I would like to do return Nan::To<String>(Nan::Get(object, key)) instead of
Nan::MaybeLocal<Value> maybe_value = Nan::Get(object, key);
if (maybe_value.IsEmpty()) {
return Nan::Nothing;
}
return Nan::To<String>(maybe_value.ToLocalChecked());
Is there a reasonable way to do this without writing my own wrapper around every one of these functions?