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:
authorSam Roberts <vieuxtech@gmail.com>2019-04-10 01:21:36 +0300
committerSam Roberts <vieuxtech@gmail.com>2019-04-12 22:33:37 +0300
commit060d901f87b3d87314f8540eb02f315e2952f581 (patch)
tree53159171201703bb6d8a4e780c8624a5c6c8cbb5 /src/node_os.cc
parent7b0d8673898e65a368108264c77bccaa3e004028 (diff)
src: replace FromJust() with Check() when possible
FromJust() is often used not for its return value, but for its side-effects. In these cases, Check() exists, and is more clear as to the intent. From its comment: To be used, where the actual value of the Maybe is not needed, like Object::Set. See: https://github.com/nodejs/node/pull/26929/files#r269256335 PR-URL: https://github.com/nodejs/node/pull/27162 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Diffstat (limited to 'src/node_os.cc')
-rw-r--r--src/node_os.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/node_os.cc b/src/node_os.cc
index 6ba4e54a3be..5dd31469004 100644
--- a/src/node_os.cc
+++ b/src/node_os.cc
@@ -325,17 +325,17 @@ static void GetUserInfo(const FunctionCallbackInfo<Value>& args) {
Local<Object> entry = Object::New(env->isolate());
- entry->Set(env->context(), env->uid_string(), uid).FromJust();
- entry->Set(env->context(), env->gid_string(), gid).FromJust();
+ entry->Set(env->context(), env->uid_string(), uid).Check();
+ entry->Set(env->context(), env->gid_string(), gid).Check();
entry->Set(env->context(),
env->username_string(),
- username.ToLocalChecked()).FromJust();
+ username.ToLocalChecked()).Check();
entry->Set(env->context(),
env->homedir_string(),
- homedir.ToLocalChecked()).FromJust();
+ homedir.ToLocalChecked()).Check();
entry->Set(env->context(),
env->shell_string(),
- shell.ToLocalChecked()).FromJust();
+ shell.ToLocalChecked()).Check();
args.GetReturnValue().Set(entry);
}
@@ -401,7 +401,7 @@ void Initialize(Local<Object> target,
env->SetMethod(target, "getPriority", GetPriority);
target->Set(env->context(),
FIXED_ONE_BYTE_STRING(env->isolate(), "isBigEndian"),
- Boolean::New(env->isolate(), IsBigEndian())).FromJust();
+ Boolean::New(env->isolate(), IsBigEndian())).Check();
}
} // namespace os