lahama 2.2.0 → 2.3.0
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/lahama.js +6 -1
- package/package.json +1 -1
package/dist/lahama.js
CHANGED
|
@@ -70,7 +70,7 @@ class ArrayWithOriginalIndices {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
isAddition(item, fromIdx) {
|
|
73
|
-
return this.findIndexFrom(item, fromIdx === -1
|
|
73
|
+
return this.findIndexFrom(item, fromIdx) === -1
|
|
74
74
|
}
|
|
75
75
|
findIndexFrom(item, fromIndex) {
|
|
76
76
|
for (let i = fromIndex; i < this.length; i++) {
|
|
@@ -122,22 +122,27 @@ function arraysDiffSequence(
|
|
|
122
122
|
const sequence = [];
|
|
123
123
|
const array = new ArrayWithOriginalIndices(oldArray, equalsFn);
|
|
124
124
|
for (let index = 0; index < newArray.length; index++) {
|
|
125
|
+
//!REMOVE CASE
|
|
125
126
|
if (array.isRemoval(index, newArray)) {
|
|
126
127
|
sequence.push(array.removeItem(index));
|
|
127
128
|
index--;
|
|
128
129
|
continue
|
|
129
130
|
}
|
|
131
|
+
//!noop case
|
|
130
132
|
if (array.isNoop(index, newArray)) {
|
|
131
133
|
sequence.push(array.noopItem(index));
|
|
132
134
|
continue
|
|
133
135
|
}
|
|
136
|
+
//!addition case
|
|
134
137
|
const item = newArray[index];
|
|
135
138
|
if (array.isAddition(item , index)) {
|
|
136
139
|
sequence.push(array.addItem(item, index));
|
|
137
140
|
continue
|
|
138
141
|
}
|
|
142
|
+
//!move case
|
|
139
143
|
sequence.push(array.moveItem(item, index));
|
|
140
144
|
}
|
|
145
|
+
//!remove extra items
|
|
141
146
|
sequence.push(...array.removeItemsAfter(newArray.length));
|
|
142
147
|
return sequence
|
|
143
148
|
}
|