inibase 1.4.3 → 1.4.5

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/file.js CHANGED
@@ -548,6 +548,7 @@ export const search = async (filePath, operator, comparedAtValue, logicalOperato
548
548
  const decodedLine = decode(line, field);
549
549
  // Check if the line meets the specified conditions based on comparison and logical operators.
550
550
  const doesMeetCondition = (Array.isArray(decodedLine) &&
551
+ operator !== "=" &&
551
552
  decodedLine.flat().some(meetsConditions)) ||
552
553
  meetsConditions(decodedLine);
553
554
  // If the line meets the conditions, process it.
@@ -6,6 +6,7 @@ import { gunzip as gunzipSync, gzip as gzipSync } from "node:zlib";
6
6
  import RE2 from "re2";
7
7
  import { globalConfig } from "./index.js";
8
8
  import { detectFieldType, isNumber, isPassword } from "./utils.js";
9
+ import Inison from "inison";
9
10
  export const exec = promisify(execSync);
10
11
  export const execFile = promisify(execFileSync);
11
12
  export const gzip = promisify(gzipSync);
@@ -86,11 +87,17 @@ export const compare = (operator, originalValue, comparedValue, fieldType) => {
86
87
  // Determine the field type if it's an array of potential types.
87
88
  if (Array.isArray(fieldType))
88
89
  fieldType = detectFieldType(String(originalValue), fieldType);
89
- // Handle comparisons involving arrays.
90
+ // Special handling when the compared value is an array.
90
91
  if (Array.isArray(comparedValue) &&
91
92
  !Array.isArray(originalValue) &&
92
93
  !["[]", "![]"].includes(operator))
93
94
  return comparedValue.some((value) => compare(operator, originalValue, value, fieldType));
95
+ // Special handling when the original value is an array.
96
+ if (Array.isArray(originalValue) &&
97
+ !Array.isArray(comparedValue) &&
98
+ !["[]", "![]"].includes(operator) &&
99
+ fieldType !== "array")
100
+ return originalValue.some((value) => compare(operator, value, comparedValue, fieldType));
94
101
  // Switch statement for different comparison operators.
95
102
  switch (operator) {
96
103
  // Equal (Case Insensitive for strings, specific handling for passwords and booleans).
@@ -164,8 +171,11 @@ export const isEqual = (originalValue, comparedValue, fieldType) => {
164
171
  if (isOriginalNullLike && isComparedNullLike)
165
172
  return true;
166
173
  // If both are arrays
167
- if (Array.isArray(originalValue) && Array.isArray(comparedValue))
168
- return JSON.stringify(originalValue) === JSON.stringify(comparedValue);
174
+ if (Array.isArray(originalValue)) {
175
+ if (Array.isArray(comparedValue))
176
+ return (JSON.stringify(originalValue) === JSON.stringify(comparedValue));
177
+ return Inison.stringify(originalValue) === comparedValue;
178
+ }
169
179
  // If both are number-like
170
180
  if (isNumber(originalValue) && isNumber(comparedValue))
171
181
  return Number(originalValue) === Number(comparedValue);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inibase",
3
- "version": "1.4.3",
3
+ "version": "1.4.5",
4
4
  "type": "module",
5
5
  "author": {
6
6
  "name": "Karim Amahtil",