Skip to content

Commit

Permalink
hotifx: patch getAttribute only use defaultValue if value is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
roncodes committed Sep 11, 2021
1 parent e361763 commit 4474cf7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 4474cf7

Please sign in to comment.