Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Otrishko <shishugi@gmail.com>2020-02-13 22:42:42 +0300
committerAnna Henningsen <anna@addaleax.net>2020-03-09 15:08:16 +0300
commit98f44296dcf5ba526f1a517effaeb309b10b9ea1 (patch)
tree0040c5a8cf9f8c8f4230ac5b9a8e54d87a24c2c9 /src/node_worker.cc
parentcee145251eef709d73a88d457d04b029f9feffd3 (diff)
src: simplify node_worker.cc using new KVStore API
PR-URL: https://github.com/nodejs/node/pull/31773 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_worker.cc')
-rw-r--r--src/node_worker.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/node_worker.cc b/src/node_worker.cc
index 1496b937d0c..6ff1a0afe99 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<Value>& 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<String> 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<String> maybe_node_opts =