File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -21,12 +21,18 @@ Value CreateBooleanFromPrimitive(const CallbackInfo& info) {
2121 return Boolean::New (info.Env (), boolean);
2222}
2323
24+ Value OperatorBool (const CallbackInfo& info) {
25+ Boolean boolean (info.Env (), info[0 ].As <Boolean>());
26+ return Boolean::New (info.Env (), static_cast <bool >(boolean));
27+ }
28+
2429Object InitBasicTypesBoolean (Env env) {
2530 Object exports = Object::New (env);
2631
2732 exports[" createBoolean" ] = Function::New (env, CreateBoolean);
2833 exports[" createEmptyBoolean" ] = Function::New (env, CreateEmptyBoolean);
2934 exports[" createBooleanFromExistingValue" ] = Function::New (env, CreateBooleanFromExistingValue);
3035 exports[" createBooleanFromPrimitive" ] = Function::New (env, CreateBooleanFromPrimitive);
36+ exports[" operatorBool" ] = Function::New (env, OperatorBool);
3137 return exports;
3238}
Original file line number Diff line number Diff line change @@ -27,4 +27,10 @@ function test(binding) {
2727 const bool6 = binding . basic_types_boolean . createBooleanFromPrimitive ( false ) ;
2828 assert . strictEqual ( bool6 , false ) ;
2929
30+ const bool7 = binding . basic_types_boolean . operatorBool ( true ) ;
31+ assert . strictEqual ( bool7 , true ) ;
32+
33+ const bool8 = binding . basic_types_boolean . operatorBool ( false ) ;
34+ assert . strictEqual ( bool8 , false ) ;
35+
3036}
You can’t perform that action at this time.
0 commit comments