Skip to content

Commit

Permalink
WTF is v8 doing moon2DUMB
Browse files Browse the repository at this point in the history
  • Loading branch information
skiptirengu committed May 16, 2019
1 parent 2bbcca3 commit c548729
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/anitomy_js.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,15 @@ bool AnitomyJs::SetOptions(Local<Object> value, Isolate *isolate) {
}

bool AnitomyJs::BoolOption(const char *name, Local<Object> value, Isolate *isolate) {
Local<Context> context = isolate->GetCurrentContext();
Local<String> entry_name = String::NewFromUtf8(isolate, name, NewStringType::kNormal).ToLocalChecked();
return value->Has(isolate->GetCurrentContext(), entry_name).FromJust()
? value->Get(isolate->GetCurrentContext(), entry_name).ToLocalChecked()->ToBoolean(isolate)->IsTrue()
return value->Has(context, entry_name).FromJust()
?
#if NODE_MAJOR_VERSION >= 12
value->Get(isolate->GetCurrentContext(), entry_name).ToLocalChecked()->ToBoolean(isolate)->IsTrue()
#else
value->Get(context, entry_name).ToLocalChecked()->ToBoolean(context).ToLocalChecked()->IsTrue()
#endif
: true;
}

Expand Down

0 comments on commit c548729

Please sign in to comment.