inibase 1.2.1 → 1.2.3
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 +3 -1
- package/dist/utils.js +6 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -903,7 +903,8 @@ export default class Inibase {
|
|
|
903
903
|
.map((column) => column.replace(`${field.key}.`, "")),
|
|
904
904
|
});
|
|
905
905
|
const formatLineContent = (lineContent) => Array.isArray(lineContent)
|
|
906
|
-
? lineContent
|
|
906
|
+
? lineContent
|
|
907
|
+
.map((singleContent) => singleContent
|
|
907
908
|
? Array.isArray(singleContent)
|
|
908
909
|
? singleContent.map(formatLineContent)
|
|
909
910
|
: items
|
|
@@ -912,6 +913,7 @@ export default class Inibase {
|
|
|
912
913
|
id: singleContent,
|
|
913
914
|
}
|
|
914
915
|
: singleContent)
|
|
916
|
+
.filter(Boolean)
|
|
915
917
|
: (items?.find(({ id }) => lineContent === id) ?? {
|
|
916
918
|
id: lineContent,
|
|
917
919
|
});
|
package/dist/utils.js
CHANGED
|
@@ -345,13 +345,14 @@ export const filterSchema = (schema, callback) => schema.filter((field) => {
|
|
|
345
345
|
export const validateFieldType = (value, field) => {
|
|
346
346
|
if (value === null)
|
|
347
347
|
return true;
|
|
348
|
-
|
|
349
|
-
|
|
348
|
+
let _fieldType = field.type;
|
|
349
|
+
if (Array.isArray(_fieldType)) {
|
|
350
|
+
const detectedFieldType = detectFieldType(value, _fieldType);
|
|
350
351
|
if (!detectedFieldType)
|
|
351
352
|
return false;
|
|
352
|
-
|
|
353
|
+
_fieldType = detectedFieldType;
|
|
353
354
|
}
|
|
354
|
-
if (
|
|
355
|
+
if (_fieldType === "array" && field.children)
|
|
355
356
|
return (Array.isArray(value) &&
|
|
356
357
|
(isArrayOfObjects(field.children) ||
|
|
357
358
|
value.every((v) => {
|
|
@@ -367,7 +368,7 @@ export const validateFieldType = (value, field) => {
|
|
|
367
368
|
type: _fieldChildrenType,
|
|
368
369
|
});
|
|
369
370
|
})));
|
|
370
|
-
switch (
|
|
371
|
+
switch (_fieldType) {
|
|
371
372
|
case "string":
|
|
372
373
|
return isString(value);
|
|
373
374
|
case "password":
|