Skip to content

Commit

Permalink
refactor BooleanOptionValue
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphtheninja committed May 12, 2015
1 parent 56def2d commit ca1f474
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,10 @@ namespace leveldown {
NAN_INLINE bool BooleanOptionValue(v8::Local<v8::Object> options,
v8::Handle<v8::String> key,
bool def = false) {
if (def) {
return options.IsEmpty()
|| !options->Has(key)
|| options->Get(key)->BooleanValue();
} else {
return !options.IsEmpty()
&& options->Has(key)
&& options->Get(key)->BooleanValue();
}
return !options.IsEmpty()
&& options->Has(key)
? options->Get(key)->BooleanValue()
: def;
}

NAN_INLINE uint32_t UInt32OptionValue(v8::Local<v8::Object> options,
Expand Down

0 comments on commit ca1f474

Please sign in to comment.