otomato-sdk 2.0.285 → 2.0.286
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.
|
@@ -346,3 +346,32 @@ export const getComparisonString = (condition, comparisonValue) => {
|
|
|
346
346
|
}
|
|
347
347
|
return `${mapTextToLogicOperator(condition)} ${comparisonValue}`;
|
|
348
348
|
};
|
|
349
|
+
/**
|
|
350
|
+
* Finds the new elements in an array compared to an old array.
|
|
351
|
+
* @param oldArray - The old array.
|
|
352
|
+
* @param newArray - The new array.
|
|
353
|
+
* @returns The new elements.
|
|
354
|
+
*/
|
|
355
|
+
export const findNewElements = (oldArray, newArray) => {
|
|
356
|
+
// Find the first position where arrays start to match
|
|
357
|
+
let matchStartIndex = -1;
|
|
358
|
+
for (let i = 0; i < newArray.length; i++) {
|
|
359
|
+
// Check if from position i, the arrays match
|
|
360
|
+
let matches = true;
|
|
361
|
+
for (let j = 0; j < oldArray.length && (i + j) < newArray.length; j++) {
|
|
362
|
+
if (oldArray[j] !== newArray[i + j]) {
|
|
363
|
+
matches = false;
|
|
364
|
+
break;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
if (matches) {
|
|
368
|
+
matchStartIndex = i;
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
// Handle different cases
|
|
373
|
+
if (matchStartIndex === -1) {
|
|
374
|
+
return newArray; // No match found, entire array is new
|
|
375
|
+
}
|
|
376
|
+
return matchStartIndex > 0 ? newArray.slice(0, matchStartIndex) : [];
|
|
377
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.286";
|
|
2
2
|
export declare function compareVersions(v1: string, v2: string): number;
|
|
@@ -113,3 +113,10 @@ export declare const mapTextToLogicOperator: (operator: string) => string;
|
|
|
113
113
|
* @returns The formatted comparison string or 'changes' if referencing history.
|
|
114
114
|
*/
|
|
115
115
|
export declare const getComparisonString: (condition: string, comparisonValue: string) => string;
|
|
116
|
+
/**
|
|
117
|
+
* Finds the new elements in an array compared to an old array.
|
|
118
|
+
* @param oldArray - The old array.
|
|
119
|
+
* @param newArray - The new array.
|
|
120
|
+
* @returns The new elements.
|
|
121
|
+
*/
|
|
122
|
+
export declare const findNewElements: (oldArray: string[], newArray: string[]) => string[];
|