From 4474cf7f9a35c5ceaafa6b14a9fb41e3f1964114 Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Sat, 11 Sep 2021 16:37:34 +0800 Subject: [PATCH] hotifx: patch getAttribute only use defaultValue if value is undefined --- src/resource.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/resource.js b/src/resource.js index be694a2..636c250 100644 --- a/src/resource.js +++ b/src/resource.js @@ -378,7 +378,13 @@ class Resource { * @param {mixed} defaultValue The default value if no attribute value */ getAttribute(attribute, defaultValue = null) { - return get(this.attributes, attribute) || defaultValue; + const value = get(this.attributes, attribute); + + if (value === undefined) { + return defaultValue; + } + + return value; } /**