inibase 1.2.16 → 1.2.18

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.
Files changed (2) hide show
  1. package/dist/index.js +6 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -821,7 +821,9 @@ export default class Inibase {
821
821
  continue;
822
822
  if (!RETURN[index][field.key][_i])
823
823
  RETURN[index][field.key][_i] = {};
824
- RETURN[index][field.key][_i][key] = value[_i];
824
+ RETURN[index][field.key][_i][key] = Array.isArray(value[_i])
825
+ ? value[_i].filter(Boolean)
826
+ : value[_i];
825
827
  }
826
828
  }
827
829
  }
@@ -905,13 +907,11 @@ export default class Inibase {
905
907
  .map((column) => column.replace(`${field.key}.`, "")),
906
908
  });
907
909
  const formatLineContent = (lineContent) => Array.isArray(lineContent)
908
- ? lineContent
909
- .map((singleContent) => singleContent
910
+ ? lineContent.map((singleContent) => singleContent
910
911
  ? Array.isArray(singleContent)
911
- ? singleContent.map(formatLineContent).filter(Boolean)
912
+ ? singleContent.map(formatLineContent)
912
913
  : items?.find(({ id }) => singleContent === id)
913
914
  : singleContent)
914
- .filter(Boolean)
915
915
  : items?.find(({ id }) => lineContent === id);
916
916
  for (const [lineNumber, lineContent] of searchableIDs.entries()) {
917
917
  if (!lineContent)
@@ -1294,7 +1294,6 @@ export default class Inibase {
1294
1294
  }
1295
1295
  const LineNumberDataObj = await this.applyCriteria(tableName, options, structuredClone(where));
1296
1296
  if (LineNumberDataObj) {
1297
- this.totalItems.set(`${tableName}-*`, Object.keys(LineNumberDataObj).length);
1298
1297
  if (onlyLinesNumbers)
1299
1298
  return onlyOne
1300
1299
  ? Number(Object.keys(LineNumberDataObj)[0])
@@ -1322,7 +1321,7 @@ export default class Inibase {
1322
1321
  ...(({ columns, ...restOfOptions }) => restOfOptions)(options),
1323
1322
  perPage: Array.isArray(RETURN) ? RETURN.length : 1,
1324
1323
  totalPages: options.perPage < 0
1325
- ? undefined
1324
+ ? 1
1326
1325
  : Math.ceil(greatestTotalItems / options.perPage),
1327
1326
  total: greatestTotalItems,
1328
1327
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inibase",
3
- "version": "1.2.16",
3
+ "version": "1.2.18",
4
4
  "type": "module",
5
5
  "author": {
6
6
  "name": "Karim Amahtil",