inibase 1.4.2 → 1.4.4

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);
@@ -87,8 +88,10 @@ export const compare = (operator, originalValue, comparedValue, fieldType) => {
87
88
  if (Array.isArray(fieldType))
88
89
  fieldType = detectFieldType(String(originalValue), fieldType);
89
90
  // Handle comparisons involving arrays.
90
- if (Array.isArray(comparedValue) && !["[]", "![]"].includes(operator))
91
- return comparedValue.some((value) => compare(operator, originalValue, value, fieldType));
91
+ if (Array.isArray(originalValue) &&
92
+ !Array.isArray(comparedValue) &&
93
+ !["[]", "![]"].includes(operator))
94
+ return originalValue.some((value) => compare(operator, value, comparedValue, fieldType));
92
95
  // Switch statement for different comparison operators.
93
96
  switch (operator) {
94
97
  // Equal (Case Insensitive for strings, specific handling for passwords and booleans).
@@ -161,6 +164,12 @@ export const isEqual = (originalValue, comparedValue, fieldType) => {
161
164
  // If both are null-like, treat as equivalent
162
165
  if (isOriginalNullLike && isComparedNullLike)
163
166
  return true;
167
+ // If both are arrays
168
+ if (Array.isArray(originalValue)) {
169
+ if (Array.isArray(comparedValue))
170
+ return (JSON.stringify(originalValue) === JSON.stringify(comparedValue));
171
+ return Inison.stringify(originalValue) === comparedValue;
172
+ }
164
173
  // If both are number-like
165
174
  if (isNumber(originalValue) && isNumber(comparedValue))
166
175
  return Number(originalValue) === Number(comparedValue);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inibase",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "type": "module",
5
5
  "author": {
6
6
  "name": "Karim Amahtil",