From e1cf9a35a1b6edc404c1b465ec94f8a821641059 Mon Sep 17 00:00:00 2001 From: NickNaso Date: Mon, 29 Apr 2019 22:17:56 +0200 Subject: [PATCH] Use `Value::IsEmpty` to check for empty value PR-URL: https://github.com/nodejs/node-addon-api/pull/478 Reviewed-By: Anna Henningsen Reviewed-By: Gabriel Schulhof Reviewed-By: Michael Dawson --- napi-inl.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/napi-inl.h b/napi-inl.h index c15ed97a1..2b91b12b8 100644 --- a/napi-inl.h +++ b/napi-inl.h @@ -271,7 +271,7 @@ inline bool Value::IsEmpty() const { } inline napi_valuetype Value::Type() const { - if (_value == nullptr) { + if (IsEmpty()) { return napi_undefined; } @@ -314,7 +314,7 @@ inline bool Value::IsSymbol() const { } inline bool Value::IsArray() const { - if (_value == nullptr) { + if (IsEmpty()) { return false; } @@ -325,7 +325,7 @@ inline bool Value::IsArray() const { } inline bool Value::IsArrayBuffer() const { - if (_value == nullptr) { + if (IsEmpty()) { return false; } @@ -336,7 +336,7 @@ inline bool Value::IsArrayBuffer() const { } inline bool Value::IsTypedArray() const { - if (_value == nullptr) { + if (IsEmpty()) { return false; } @@ -355,7 +355,7 @@ inline bool Value::IsFunction() const { } inline bool Value::IsPromise() const { - if (_value == nullptr) { + if (IsEmpty()) { return false; } @@ -366,7 +366,7 @@ inline bool Value::IsPromise() const { } inline bool Value::IsDataView() const { - if (_value == nullptr) { + if (IsEmpty()) { return false; } @@ -377,7 +377,7 @@ inline bool Value::IsDataView() const { } inline bool Value::IsBuffer() const { - if (_value == nullptr) { + if (IsEmpty()) { return false; }