kafka-ts 1.2.0 → 1.2.1
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/utils/decoder.js +5 -3
- package/package.json +1 -1
package/dist/utils/decoder.js
CHANGED
|
@@ -110,21 +110,23 @@ class Decoder {
|
|
|
110
110
|
}
|
|
111
111
|
readArray(callback) {
|
|
112
112
|
const length = this.readInt32();
|
|
113
|
-
const results = new Array(length);
|
|
113
|
+
const results = new Array(Math.max(length, 0));
|
|
114
114
|
for (let i = 0; i < length; i++)
|
|
115
115
|
results[i] = callback(this);
|
|
116
116
|
return results;
|
|
117
117
|
}
|
|
118
118
|
readCompactArray(callback) {
|
|
119
119
|
const length = this.readUVarInt() - 1;
|
|
120
|
-
const results = new Array(length);
|
|
120
|
+
const results = new Array(Math.max(length, 0));
|
|
121
121
|
for (let i = 0; i < length; i++)
|
|
122
122
|
results[i] = callback(this);
|
|
123
123
|
return results;
|
|
124
124
|
}
|
|
125
125
|
readVarIntArray(callback) {
|
|
126
126
|
const length = this.readVarInt();
|
|
127
|
-
const results = Array.
|
|
127
|
+
const results = new Array(Math.max(length, 0));
|
|
128
|
+
for (let i = 0; i < length; i++)
|
|
129
|
+
results[i] = callback(this);
|
|
128
130
|
return results;
|
|
129
131
|
}
|
|
130
132
|
readRecords(callback) {
|