socket.io-parser
Advanced tools
@@ -21,3 +21,3 @@ "use strict"; | ||
| } | ||
| function _deconstructPacket(data, buffers) { | ||
| function _deconstructPacket(data, buffers, toJSON) { | ||
| if (!data) | ||
@@ -38,2 +38,5 @@ return data; | ||
| else if (typeof data === "object" && !(data instanceof Date)) { | ||
| if (data.toJSON && typeof data.toJSON === "function" && !toJSON) { | ||
| return _deconstructPacket(data.toJSON(), buffers, true); | ||
| } | ||
| const newData = {}; | ||
@@ -40,0 +43,0 @@ for (const key in data) { |
| "use strict"; | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
| return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -8,3 +11,3 @@ exports.Decoder = exports.Encoder = exports.PacketType = exports.protocol = void 0; | ||
| const is_binary_js_1 = require("./is-binary.js"); | ||
| const debug_1 = require("debug"); // debug() | ||
| const debug_1 = __importDefault(require("debug")); // debug() | ||
| const debug = (0, debug_1.default)("socket.io-parser"); // debug() | ||
@@ -146,6 +149,2 @@ /** | ||
| this.reconstructor = new BinaryReconstructor(packet); | ||
| // no attachments, labeled binary but no binary data to follow | ||
| if (packet.attachments === 0) { | ||
| super.emitReserved("decoded", packet); | ||
| } | ||
| } | ||
@@ -200,3 +199,3 @@ else { | ||
| const n = Number(buf); | ||
| if (!isInteger(n) || n < 0) { | ||
| if (!isInteger(n) || n < 1) { | ||
| throw new Error("Illegal attachments"); | ||
@@ -203,0 +202,0 @@ } |
@@ -17,3 +17,3 @@ import { isBinary } from "./is-binary.js"; | ||
| } | ||
| function _deconstructPacket(data, buffers) { | ||
| function _deconstructPacket(data, buffers, toJSON) { | ||
| if (!data) | ||
@@ -34,2 +34,5 @@ return data; | ||
| else if (typeof data === "object" && !(data instanceof Date)) { | ||
| if (data.toJSON && typeof data.toJSON === "function" && !toJSON) { | ||
| return _deconstructPacket(data.toJSON(), buffers, true); | ||
| } | ||
| const newData = {}; | ||
@@ -36,0 +39,0 @@ for (const key in data) { |
@@ -140,6 +140,2 @@ import { Emitter } from "@socket.io/component-emitter"; | ||
| this.reconstructor = new BinaryReconstructor(packet); | ||
| // no attachments, labeled binary but no binary data to follow | ||
| if (packet.attachments === 0) { | ||
| super.emitReserved("decoded", packet); | ||
| } | ||
| } | ||
@@ -194,3 +190,3 @@ else { | ||
| const n = Number(buf); | ||
| if (!isInteger(n) || n < 0) { | ||
| if (!isInteger(n) || n < 1) { | ||
| throw new Error("Illegal attachments"); | ||
@@ -197,0 +193,0 @@ } |
@@ -17,3 +17,3 @@ import { isBinary } from "./is-binary.js"; | ||
| } | ||
| function _deconstructPacket(data, buffers) { | ||
| function _deconstructPacket(data, buffers, toJSON) { | ||
| if (!data) | ||
@@ -34,2 +34,5 @@ return data; | ||
| else if (typeof data === "object" && !(data instanceof Date)) { | ||
| if (data.toJSON && typeof data.toJSON === "function" && !toJSON) { | ||
| return _deconstructPacket(data.toJSON(), buffers, true); | ||
| } | ||
| const newData = {}; | ||
@@ -36,0 +39,0 @@ for (const key in data) { |
@@ -136,6 +136,2 @@ import { Emitter } from "@socket.io/component-emitter"; | ||
| this.reconstructor = new BinaryReconstructor(packet); | ||
| // no attachments, labeled binary but no binary data to follow | ||
| if (packet.attachments === 0) { | ||
| super.emitReserved("decoded", packet); | ||
| } | ||
| } | ||
@@ -190,3 +186,3 @@ else { | ||
| const n = Number(buf); | ||
| if (!isInteger(n) || n < 0) { | ||
| if (!isInteger(n) || n < 1) { | ||
| throw new Error("Illegal attachments"); | ||
@@ -193,0 +189,0 @@ } |
+1
-1
| { | ||
| "name": "socket.io-parser", | ||
| "version": "4.2.6", | ||
| "version": "4.2.7", | ||
| "description": "socket.io protocol parser", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/socketio/socket.io/tree/main/packages/socket.io-client#readme", |
64127
0.05%