@primestyleai/tryon 3.9.0 → 3.9.1
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/react/index.js +21 -11
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -216,18 +216,28 @@ function allKeysAreSectionNames(obj) {
|
|
|
216
216
|
function tryPreNormalized(input) {
|
|
217
217
|
if (!isObject(input)) return null;
|
|
218
218
|
const obj = input;
|
|
219
|
-
if (
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
219
|
+
if (!Array.isArray(obj.headers) || !Array.isArray(obj.rows) || obj.headers.length === 0 || obj.rows.length === 0) {
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
const headers = obj.headers;
|
|
223
|
+
let rows;
|
|
224
|
+
const firstRow = obj.rows[0];
|
|
225
|
+
if (Array.isArray(firstRow)) {
|
|
226
|
+
rows = obj.rows.map((r) => r.map(String));
|
|
227
|
+
} else if (isObject(firstRow)) {
|
|
228
|
+
rows = obj.rows.map(
|
|
229
|
+
(rowObj) => headers.map((h) => String(rowObj[h] ?? ""))
|
|
230
|
+
);
|
|
231
|
+
} else {
|
|
232
|
+
return null;
|
|
229
233
|
}
|
|
230
|
-
return
|
|
234
|
+
return {
|
|
235
|
+
found: true,
|
|
236
|
+
title: typeof obj.title === "string" ? obj.title : void 0,
|
|
237
|
+
headers,
|
|
238
|
+
rows,
|
|
239
|
+
requiredFields: Array.isArray(obj.requiredFields) && obj.requiredFields.length > 0 ? obj.requiredFields : deriveRequiredFields(headers)
|
|
240
|
+
};
|
|
231
241
|
}
|
|
232
242
|
function tryKeyValueObject(input) {
|
|
233
243
|
if (!isObject(input)) return null;
|