Comparing version 1.2.0 to 1.2.1
10
index.js
@@ -132,2 +132,10 @@ /////////////////////////////////////////////////////////////////////////////// | ||
// Helper function to check if an object is empty (including arrays) | ||
const isEmpty = (obj) => { | ||
if (obj == null) return true | ||
if (Array.isArray(obj)) return obj.length === 0 | ||
if (typeof obj === 'object') return Object.keys(obj).length === 0 | ||
return false | ||
} | ||
if ( | ||
@@ -137,3 +145,3 @@ evaluatedCondition === false || | ||
evaluatedCondition === '' || | ||
(typeof evaluatedCondition === 'object' && Object.keys(evaluatedCondition).length === 0) | ||
isEmpty(evaluatedCondition) | ||
) { | ||
@@ -140,0 +148,0 @@ return '' |
{ | ||
"name": "html-fns", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Set of convinient pure functions to generate HTML on server-side via tagged template literals.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
13948
5
305