@@ -710,40 +710,49 @@ CheckTypeTag(napi_env env, napi_callback_info info) {
710710 return js_result ;
711711}
712712
713- static napi_value TestCreateObjectWithProperties (napi_env env , napi_callback_info info ) {
713+ static napi_value TestCreateObjectWithProperties (napi_env env ,
714+ napi_callback_info info ) {
714715 napi_value names [3 ];
715716 napi_value values [3 ];
716717 napi_value result ;
717718
718- NODE_API_CALL (env , napi_create_string_utf8 (env , "name" , NAPI_AUTO_LENGTH , & names [0 ]));
719- NODE_API_CALL (env , napi_create_string_utf8 (env , "Foo" , NAPI_AUTO_LENGTH , & values [0 ]));
719+ NODE_API_CALL (
720+ env , napi_create_string_utf8 (env , "name" , NAPI_AUTO_LENGTH , & names [0 ]));
721+ NODE_API_CALL (
722+ env , napi_create_string_utf8 (env , "Foo" , NAPI_AUTO_LENGTH , & values [0 ]));
720723
721- NODE_API_CALL (env , napi_create_string_utf8 (env , "age" , NAPI_AUTO_LENGTH , & names [1 ]));
724+ NODE_API_CALL (
725+ env , napi_create_string_utf8 (env , "age" , NAPI_AUTO_LENGTH , & names [1 ]));
722726 NODE_API_CALL (env , napi_create_int32 (env , 42 , & values [1 ]));
723727
724- NODE_API_CALL (env , napi_create_string_utf8 (env , "active" , NAPI_AUTO_LENGTH , & names [2 ]));
728+ NODE_API_CALL (
729+ env , napi_create_string_utf8 (env , "active" , NAPI_AUTO_LENGTH , & names [2 ]));
725730 NODE_API_CALL (env , napi_get_boolean (env , true, & values [2 ]));
726731
727732 napi_value null_prototype ;
728733 NODE_API_CALL (env , napi_get_null (env , & null_prototype ));
729- NODE_API_CALL (env , napi_create_object_with_properties (
730- env , null_prototype , names , values , 3 , & result ));
734+ NODE_API_CALL (env ,
735+ napi_create_object_with_properties (
736+ env , null_prototype , names , values , 3 , & result ));
731737
732738 return result ;
733739}
734740
735- static napi_value TestCreateObjectWithPropertiesEmpty (napi_env env , napi_callback_info info ) {
741+ static napi_value TestCreateObjectWithPropertiesEmpty (napi_env env ,
742+ napi_callback_info info ) {
736743 napi_value result ;
737744
738745 napi_value null_prototype ;
739746 NODE_API_CALL (env , napi_get_null (env , & null_prototype ));
740- NODE_API_CALL (env , napi_create_object_with_properties (
741- env , null_prototype , NULL , NULL , 0 , & result ));
747+ NODE_API_CALL (env ,
748+ napi_create_object_with_properties (
749+ env , null_prototype , NULL , NULL , 0 , & result ));
742750
743751 return result ;
744752}
745753
746- static napi_value TestCreateObjectWithCustomPrototype (napi_env env , napi_callback_info info ) {
754+ static napi_value TestCreateObjectWithCustomPrototype (napi_env env ,
755+ napi_callback_info info ) {
747756 napi_value prototype ;
748757 napi_value method_name ;
749758 napi_value method_func ;
@@ -752,16 +761,26 @@ static napi_value TestCreateObjectWithCustomPrototype(napi_env env, napi_callbac
752761 napi_value result ;
753762
754763 NODE_API_CALL (env , napi_create_object (env , & prototype ));
755- NODE_API_CALL (env , napi_create_string_utf8 (env , "test" , NAPI_AUTO_LENGTH , & method_name ));
756- NODE_API_CALL (env , napi_create_function (env , "test" , NAPI_AUTO_LENGTH ,
757- TestCreateObjectWithProperties , NULL , & method_func ));
758- NODE_API_CALL (env , napi_set_property (env , prototype , method_name , method_func ));
764+ NODE_API_CALL (
765+ env ,
766+ napi_create_string_utf8 (env , "test" , NAPI_AUTO_LENGTH , & method_name ));
767+ NODE_API_CALL (env ,
768+ napi_create_function (env ,
769+ "test" ,
770+ NAPI_AUTO_LENGTH ,
771+ TestCreateObjectWithProperties ,
772+ NULL ,
773+ & method_func ));
774+ NODE_API_CALL (env ,
775+ napi_set_property (env , prototype , method_name , method_func ));
759776
760- NODE_API_CALL (env , napi_create_string_utf8 (env , "value" , NAPI_AUTO_LENGTH , & names [0 ]));
777+ NODE_API_CALL (
778+ env , napi_create_string_utf8 (env , "value" , NAPI_AUTO_LENGTH , & names [0 ]));
761779 NODE_API_CALL (env , napi_create_int32 (env , 42 , & values [0 ]));
762780
763- NODE_API_CALL (env , napi_create_object_with_properties (
764- env , prototype , names , values , 1 , & result ));
781+ NODE_API_CALL (env ,
782+ napi_create_object_with_properties (
783+ env , prototype , names , values , 1 , & result ));
765784
766785 return result ;
767786}
@@ -799,9 +818,12 @@ napi_value Init(napi_env env, napi_value exports) {
799818 DECLARE_NODE_API_PROPERTY ("TestGetProperty" , TestGetProperty ),
800819 DECLARE_NODE_API_PROPERTY ("TestFreeze" , TestFreeze ),
801820 DECLARE_NODE_API_PROPERTY ("TestSeal" , TestSeal ),
802- DECLARE_NODE_API_PROPERTY ("TestCreateObjectWithProperties" , TestCreateObjectWithProperties ),
803- DECLARE_NODE_API_PROPERTY ("TestCreateObjectWithPropertiesEmpty" , TestCreateObjectWithPropertiesEmpty ),
804- DECLARE_NODE_API_PROPERTY ("TestCreateObjectWithCustomPrototype" , TestCreateObjectWithCustomPrototype ),
821+ DECLARE_NODE_API_PROPERTY ("TestCreateObjectWithProperties" ,
822+ TestCreateObjectWithProperties ),
823+ DECLARE_NODE_API_PROPERTY ("TestCreateObjectWithPropertiesEmpty" ,
824+ TestCreateObjectWithPropertiesEmpty ),
825+ DECLARE_NODE_API_PROPERTY ("TestCreateObjectWithCustomPrototype" ,
826+ TestCreateObjectWithCustomPrototype ),
805827 };
806828
807829 init_test_null (env , exports );
0 commit comments