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) {
21
21
return Boolean::New (info.Env (), boolean);
22
22
}
23
23
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
+
24
29
Object InitBasicTypesBoolean (Env env) {
25
30
Object exports = Object::New (env);
26
31
27
32
exports[" createBoolean" ] = Function::New (env, CreateBoolean);
28
33
exports[" createEmptyBoolean" ] = Function::New (env, CreateEmptyBoolean);
29
34
exports[" createBooleanFromExistingValue" ] = Function::New (env, CreateBooleanFromExistingValue);
30
35
exports[" createBooleanFromPrimitive" ] = Function::New (env, CreateBooleanFromPrimitive);
36
+ exports[" operatorBool" ] = Function::New (env, OperatorBool);
31
37
return exports;
32
38
}
Original file line number Diff line number Diff line change @@ -27,4 +27,10 @@ function test(binding) {
27
27
const bool6 = binding . basic_types_boolean . createBooleanFromPrimitive ( false ) ;
28
28
assert . strictEqual ( bool6 , false ) ;
29
29
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
+
30
36
}
You can’t perform that action at this time.
0 commit comments