Skip to content

Commit

Permalink
src: simplify node_worker.cc using new KVStore API
Browse files Browse the repository at this point in the history
  • Loading branch information
lundibundi committed Feb 13, 2020
1 parent 6693cfb commit d38ed6c
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/node_worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -482,14 +483,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 =
Expand Down

0 comments on commit d38ed6c

Please sign in to comment.