inibase 1.4.3 → 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 +1 -0
- package/dist/utils.server.js +9 -5
- package/package.json +1 -1
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.
|
package/dist/utils.server.js
CHANGED
|
@@ -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,10 +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(
|
|
91
|
-
!Array.isArray(
|
|
91
|
+
if (Array.isArray(originalValue) &&
|
|
92
|
+
!Array.isArray(comparedValue) &&
|
|
92
93
|
!["[]", "![]"].includes(operator))
|
|
93
|
-
return
|
|
94
|
+
return originalValue.some((value) => compare(operator, value, comparedValue, fieldType));
|
|
94
95
|
// Switch statement for different comparison operators.
|
|
95
96
|
switch (operator) {
|
|
96
97
|
// Equal (Case Insensitive for strings, specific handling for passwords and booleans).
|
|
@@ -164,8 +165,11 @@ export const isEqual = (originalValue, comparedValue, fieldType) => {
|
|
|
164
165
|
if (isOriginalNullLike && isComparedNullLike)
|
|
165
166
|
return true;
|
|
166
167
|
// If both are arrays
|
|
167
|
-
if (Array.isArray(originalValue)
|
|
168
|
-
|
|
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
|
+
}
|
|
169
173
|
// If both are number-like
|
|
170
174
|
if (isNumber(originalValue) && isNumber(comparedValue))
|
|
171
175
|
return Number(originalValue) === Number(comparedValue);
|