From 2fa32d8e5d9c46f16c98fc069752baa687d572fd Mon Sep 17 00:00:00 2001
From: Luis Blanco <luisblanco1337@gmail.com>
Date: Thu, 8 Aug 2019 16:32:06 +0300
Subject: [PATCH] Fix macros

---
 include/addon-tools.hpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/addon-tools.hpp b/include/addon-tools.hpp
index 4551566..cac4534 100644
--- a/include/addon-tools.hpp
+++ b/include/addon-tools.hpp
@@ -12,9 +12,9 @@
 #define JS_STR(VAL) Napi::String::New(env, VAL)
 #define JS_NUM(VAL) Napi::Number::New(env, static_cast<double>(VAL))
 #define JS_EXT(VAL) Napi::External::New(env, reinterpret_cast<void*>(VAL))
-#define JS_BOOL(VAL) Napi::Boolean::New(env, VAL)
-#define JS_FUN(VAL) Napi::Function::Function(env, VAL)
-#define JS_OBJ(VAL) Napi::Object::Object(env, VAL)
+#define JS_BOOL(VAL) Napi::Boolean::New(env, static_cast<bool>(VAL))
+#define JS_FUN(VAL) Napi::Function::New(env, VAL)
+#define JS_OBJ(VAL) Napi::Object::New(env, VAL)
 
 
 #define RET_VALUE(VAL) return VAL;
@@ -74,7 +74,7 @@
 
 #define USE_INT32_ARG(I, VAR, DEF)                                            \
 	CHECK_LET_ARG(I, IsNumber(), "Int32");                                    \
-	int VAR = IS_ARG_EMPTY(I) ? (DEF) : info[I].Int32Value();
+	int VAR = IS_ARG_EMPTY(I) ? (DEF) : info[I].ToNumber().Int32Value();
 
 #define LET_INT32_ARG(I, VAR) USE_INT32_ARG(I, VAR, 0)