diff --git a/src/protocol/encoder.js b/src/protocol/encoder.js index 5c8f9b7a1..d1c1f692e 100644 --- a/src/protocol/encoder.js +++ b/src/protocol/encoder.js @@ -202,6 +202,10 @@ module.exports = class Encoder { return this } + /** + * @param {any[]} array + * @param {'int32'|'number'|'string'|'object'} [type] + */ writeNullableArray(array, type) { // A null value is encoded with length of -1 and there are no following bytes // On the context of this library, empty array and null are the same thing @@ -209,6 +213,11 @@ module.exports = class Encoder { return this.writeArray(array, type, length) } + /** + * @param {any[]} array + * @param {'int32'|'number'|'string'|'object'} [type] + * @param {number} [length] + */ writeArray(array, type, length) { const arrayLength = length == null ? array.length : length this.writeInt32(arrayLength) @@ -228,7 +237,6 @@ module.exports = class Encoder { } else { array.forEach(value => { switch (typeof value) { - case 'int32': case 'number': this.writeInt32(value) break