Skip to content

Commit cc27846

Browse files
lundibundiMylesBorins
authored andcommitted
src: simplify node_worker.cc using new KVStore API
PR-URL: #31773 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 296f35b commit cc27846

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/node_worker.cc

+4-8
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ using v8::Integer;
3030
using v8::Isolate;
3131
using v8::Local;
3232
using v8::Locker;
33+
using v8::Maybe;
3334
using v8::MaybeLocal;
3435
using v8::Null;
3536
using v8::Number;
@@ -496,14 +497,9 @@ void Worker::New(const FunctionCallbackInfo<Value>& args) {
496497
if (args[1]->IsObject() || args[2]->IsArray()) {
497498
per_isolate_opts.reset(new PerIsolateOptions());
498499

499-
HandleEnvOptions(
500-
per_isolate_opts->per_env, [isolate, &env_vars](const char* name) {
501-
MaybeLocal<String> value =
502-
env_vars->Get(isolate, OneByteString(isolate, name));
503-
return value.IsEmpty() ? std::string{}
504-
: std::string(*String::Utf8Value(
505-
isolate, value.ToLocalChecked()));
506-
});
500+
HandleEnvOptions(per_isolate_opts->per_env, [&env_vars](const char* name) {
501+
return env_vars->Get(name).FromMaybe("");
502+
});
507503

508504
#ifndef NODE_WITHOUT_NODE_OPTIONS
509505
MaybeLocal<String> maybe_node_opts =

0 commit comments

Comments
 (0)