Skip to content

Commit 88fedfc

Browse files
devasciaddaleax
authored andcommitted
src: refactor RealEnvStore methods - Joyee Cheung’s review remarks fixed
Modified an if statment and formatted the code as per Joyee Cheung's review comments Fixes: nodejs#27211 Refs: nodejs#27310 (comment) Refs: nodejs#27310 (comment)
1 parent b40d71e commit 88fedfc

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/node_env_var.cc

+5-6
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,9 @@ std::shared_ptr<KVStore> KVStore::Clone(v8::Isolate* isolate) const {
199199
for (uint32_t i = 0; i < keys_length; i++) {
200200
Local<Value> key = keys->Get(context, i).ToLocalChecked();
201201
CHECK(key->IsString());
202-
copy->Set(isolate, key.As<String>(), Get(isolate, key.As<String>())
203-
.ToLocalChecked());
202+
copy->Set(isolate,
203+
key.As<String>(),
204+
Get(isolate, key.As<String>()).ToLocalChecked());
204205
}
205206
return copy;
206207
}
@@ -293,11 +294,9 @@ static void EnvGetter(Local<Name> property,
293294
CHECK(property->IsString());
294295
MaybeLocal<String> value_string =
295296
env->env_vars()->Get(env->isolate(), property.As<String>());
296-
if (value_string.IsEmpty()) {
297-
info.GetReturnValue().Set(value_string.FromMaybe(Local<String>()));
298-
return;
297+
if (!value_string.IsEmpty()) {
298+
info.GetReturnValue().Set(value_string.ToLocalChecked());
299299
}
300-
info.GetReturnValue().Set(value_string.ToLocalChecked());
301300
}
302301

303302
static void EnvSetter(Local<Name> property,

0 commit comments

Comments
 (0)