react-solidlike 2.2.1 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +7 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -109,10 +109,16 @@ function Repeat({ times, children }) {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
function Show({ when, children, fallback = null }) {
|
|
112
|
-
if (!when) return fallback;
|
|
112
|
+
if (!when || isEmpty(when)) return fallback;
|
|
113
113
|
if (typeof children === "function") return children(when);
|
|
114
114
|
return children;
|
|
115
115
|
}
|
|
116
|
+
function isEmpty(value) {
|
|
117
|
+
if (Array.isArray(value)) return value.length === 0;
|
|
118
|
+
if (value instanceof Map || value instanceof Set) return value.size === 0;
|
|
119
|
+
if (typeof value === "object" && value !== null && Object.getPrototypeOf(value) === Object.prototype) return Object.keys(value).length === 0;
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
116
122
|
|
|
117
123
|
function Match(_props) {
|
|
118
124
|
return null;
|
package/package.json
CHANGED