From cc27846fb9b27d23a513dddad4135ad93d8a1700 Mon Sep 17 00:00:00 2001 From: Denys Otrishko Date: Thu, 13 Feb 2020 21:42:42 +0200 Subject: [PATCH] src: simplify node_worker.cc using new KVStore API PR-URL: https://github.com/nodejs/node/pull/31773 Reviewed-By: Anna Henningsen Reviewed-By: Joyee Cheung Reviewed-By: James M Snell --- src/node_worker.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/node_worker.cc b/src/node_worker.cc index 8f3a8e88e4a61d..d0b2579ff859a1 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -30,6 +30,7 @@ using v8::Integer; using v8::Isolate; using v8::Local; using v8::Locker; +using v8::Maybe; using v8::MaybeLocal; using v8::Null; using v8::Number; @@ -496,14 +497,9 @@ void Worker::New(const FunctionCallbackInfo& args) { if (args[1]->IsObject() || args[2]->IsArray()) { per_isolate_opts.reset(new PerIsolateOptions()); - HandleEnvOptions( - per_isolate_opts->per_env, [isolate, &env_vars](const char* name) { - MaybeLocal value = - env_vars->Get(isolate, OneByteString(isolate, name)); - return value.IsEmpty() ? std::string{} - : std::string(*String::Utf8Value( - isolate, value.ToLocalChecked())); - }); + HandleEnvOptions(per_isolate_opts->per_env, [&env_vars](const char* name) { + return env_vars->Get(name).FromMaybe(""); + }); #ifndef NODE_WITHOUT_NODE_OPTIONS MaybeLocal maybe_node_opts =