From 98f44296dcf5ba526f1a517effaeb309b10b9ea1 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 1496b937d0c698..6ff1a0afe9915b 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -31,6 +31,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 =