Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

engine.io-parser

Package Overview
Dependencies
Maintainers
2
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

engine.io-parser - npm Package Compare versions

Comparing version 5.2.1 to 5.2.2

2

build/cjs/commons.js

@@ -15,3 +15,3 @@ "use strict";

exports.PACKET_TYPES_REVERSE = PACKET_TYPES_REVERSE;
Object.keys(PACKET_TYPES).forEach(key => {
Object.keys(PACKET_TYPES).forEach((key) => {
PACKET_TYPES_REVERSE[PACKET_TYPES[key]] = key;

@@ -18,0 +18,0 @@ });

@@ -11,3 +11,3 @@ "use strict";

type: "message",
data: mapBinary(encodedPacket, binaryType)
data: mapBinary(encodedPacket, binaryType),
};

@@ -19,3 +19,3 @@ }

type: "message",
data: decodeBase64Packet(encodedPacket.substring(1), binaryType)
data: decodeBase64Packet(encodedPacket.substring(1), binaryType),
};

@@ -30,6 +30,6 @@ }

type: commons_js_1.PACKET_TYPES_REVERSE[type],
data: encodedPacket.substring(1)
data: encodedPacket.substring(1),
}
: {
type: commons_js_1.PACKET_TYPES_REVERSE[type]
type: commons_js_1.PACKET_TYPES_REVERSE[type],
};

@@ -36,0 +36,0 @@ };

@@ -9,3 +9,3 @@ "use strict";

type: "message",
data: mapBinary(encodedPacket, binaryType)
data: mapBinary(encodedPacket, binaryType),
};

@@ -18,3 +18,3 @@ }

type: "message",
data: mapBinary(buffer, binaryType)
data: mapBinary(buffer, binaryType),
};

@@ -28,6 +28,6 @@ }

type: commons_js_1.PACKET_TYPES_REVERSE[type],
data: encodedPacket.substring(1)
data: encodedPacket.substring(1),
}
: {
type: commons_js_1.PACKET_TYPES_REVERSE[type]
type: commons_js_1.PACKET_TYPES_REVERSE[type],
};

@@ -34,0 +34,0 @@ };

@@ -10,3 +10,3 @@ "use strict";

// ArrayBuffer.isView method is not defined in IE10
const isView = obj => {
const isView = (obj) => {
return typeof ArrayBuffer.isView === "function"

@@ -60,6 +60,3 @@ ? ArrayBuffer.isView(obj)

if (withNativeBlob && packet.data instanceof Blob) {
return packet.data
.arrayBuffer()
.then(toArray)
.then(callback);
return packet.data.arrayBuffer().then(toArray).then(callback);
}

@@ -70,3 +67,3 @@ else if (withNativeArrayBuffer &&

}
encodePacket(packet, false, encoded => {
encodePacket(packet, false, (encoded) => {
if (!TEXT_ENCODER) {

@@ -73,0 +70,0 @@ TEXT_ENCODER = new TextEncoder();

@@ -30,3 +30,3 @@ "use strict";

}
(0, exports.encodePacket)(packet, true, encoded => {
(0, exports.encodePacket)(packet, true, (encoded) => {
if (!TEXT_ENCODER) {

@@ -33,0 +33,0 @@ // lazily created for compatibility with Node.js 10

@@ -0,4 +1,6 @@

/// <reference types="node" />
import { encodePacket } from "./encodePacket.js";
import { decodePacket } from "./decodePacket.js";
import { Packet, PacketType, RawData, BinaryType } from "./commons.js";
import type { TransformStream } from "node:stream/web";
declare const encodePayload: (packets: Packet[], callback: (encodedPayload: string) => void) => void;

@@ -9,2 +11,2 @@ declare const decodePayload: (encodedPayload: string, binaryType?: BinaryType) => Packet[];

export declare const protocol = 4;
export { encodePacket, encodePayload, decodePacket, decodePayload, Packet, PacketType, RawData, BinaryType };
export { encodePacket, encodePayload, decodePacket, decodePayload, Packet, PacketType, RawData, BinaryType, };

@@ -17,3 +17,3 @@ "use strict";

// force base64 encoding for binary packets
(0, encodePacket_js_1.encodePacket)(packet, false, encodedPacket => {
(0, encodePacket_js_1.encodePacket)(packet, false, (encodedPacket) => {
encodedPackets[i] = encodedPacket;

@@ -41,5 +41,6 @@ if (++count === length) {

function createPacketEncoderStream() {
// @ts-expect-error
return new TransformStream({
transform(packet, controller) {
(0, encodePacket_js_1.encodePacketToBinary)(packet, encodedPacket => {
(0, encodePacket_js_1.encodePacketToBinary)(packet, (encodedPacket) => {
const payloadLength = encodedPacket.length;

@@ -71,3 +72,3 @@ let header;

});
}
},
});

@@ -106,2 +107,3 @@ }

let isBinary = false;
// @ts-expect-error
return new TransformStream({

@@ -164,3 +166,3 @@ transform(chunk, controller) {

}
}
},
});

@@ -167,0 +169,0 @@ }

@@ -10,3 +10,3 @@ const PACKET_TYPES = Object.create(null); // no Map = no polyfill

const PACKET_TYPES_REVERSE = Object.create(null);
Object.keys(PACKET_TYPES).forEach(key => {
Object.keys(PACKET_TYPES).forEach((key) => {
PACKET_TYPES_REVERSE[PACKET_TYPES[key]] = key;

@@ -13,0 +13,0 @@ });

@@ -1,2 +0,2 @@

import { ERROR_PACKET, PACKET_TYPES_REVERSE } from "./commons.js";
import { ERROR_PACKET, PACKET_TYPES_REVERSE, } from "./commons.js";
import { decode } from "./contrib/base64-arraybuffer.js";

@@ -8,3 +8,3 @@ const withNativeArrayBuffer = typeof ArrayBuffer === "function";

type: "message",
data: mapBinary(encodedPacket, binaryType)
data: mapBinary(encodedPacket, binaryType),
};

@@ -16,3 +16,3 @@ }

type: "message",
data: decodeBase64Packet(encodedPacket.substring(1), binaryType)
data: decodeBase64Packet(encodedPacket.substring(1), binaryType),
};

@@ -27,6 +27,6 @@ }

type: PACKET_TYPES_REVERSE[type],
data: encodedPacket.substring(1)
data: encodedPacket.substring(1),
}
: {
type: PACKET_TYPES_REVERSE[type]
type: PACKET_TYPES_REVERSE[type],
};

@@ -33,0 +33,0 @@ };

@@ -1,2 +0,2 @@

import { ERROR_PACKET, PACKET_TYPES_REVERSE } from "./commons.js";
import { ERROR_PACKET, PACKET_TYPES_REVERSE, } from "./commons.js";
export const decodePacket = (encodedPacket, binaryType) => {

@@ -6,3 +6,3 @@ if (typeof encodedPacket !== "string") {

type: "message",
data: mapBinary(encodedPacket, binaryType)
data: mapBinary(encodedPacket, binaryType),
};

@@ -15,3 +15,3 @@ }

type: "message",
data: mapBinary(buffer, binaryType)
data: mapBinary(buffer, binaryType),
};

@@ -25,6 +25,6 @@ }

type: PACKET_TYPES_REVERSE[type],
data: encodedPacket.substring(1)
data: encodedPacket.substring(1),
}
: {
type: PACKET_TYPES_REVERSE[type]
type: PACKET_TYPES_REVERSE[type],
};

@@ -31,0 +31,0 @@ };

@@ -7,3 +7,3 @@ import { PACKET_TYPES } from "./commons.js";

// ArrayBuffer.isView method is not defined in IE10
const isView = obj => {
const isView = (obj) => {
return typeof ArrayBuffer.isView === "function"

@@ -56,6 +56,3 @@ ? ArrayBuffer.isView(obj)

if (withNativeBlob && packet.data instanceof Blob) {
return packet.data
.arrayBuffer()
.then(toArray)
.then(callback);
return packet.data.arrayBuffer().then(toArray).then(callback);
}

@@ -66,3 +63,3 @@ else if (withNativeArrayBuffer &&

}
encodePacket(packet, false, encoded => {
encodePacket(packet, false, (encoded) => {
if (!TEXT_ENCODER) {

@@ -69,0 +66,0 @@ TEXT_ENCODER = new TextEncoder();

@@ -26,3 +26,3 @@ import { PACKET_TYPES } from "./commons.js";

}
encodePacket(packet, true, encoded => {
encodePacket(packet, true, (encoded) => {
if (!TEXT_ENCODER) {

@@ -29,0 +29,0 @@ // lazily created for compatibility with Node.js 10

@@ -0,4 +1,6 @@

/// <reference types="node" />
import { encodePacket } from "./encodePacket.js";
import { decodePacket } from "./decodePacket.js";
import { Packet, PacketType, RawData, BinaryType } from "./commons.js";
import type { TransformStream } from "node:stream/web";
declare const encodePayload: (packets: Packet[], callback: (encodedPayload: string) => void) => void;

@@ -9,2 +11,2 @@ declare const decodePayload: (encodedPayload: string, binaryType?: BinaryType) => Packet[];

export declare const protocol = 4;
export { encodePacket, encodePayload, decodePacket, decodePayload, Packet, PacketType, RawData, BinaryType };
export { encodePacket, encodePayload, decodePacket, decodePayload, Packet, PacketType, RawData, BinaryType, };
import { encodePacket, encodePacketToBinary } from "./encodePacket.js";
import { decodePacket } from "./decodePacket.js";
import { ERROR_PACKET } from "./commons.js";
import { ERROR_PACKET, } from "./commons.js";
const SEPARATOR = String.fromCharCode(30); // see https://en.wikipedia.org/wiki/Delimiter#ASCII_delimited_text

@@ -12,3 +12,3 @@ const encodePayload = (packets, callback) => {

// force base64 encoding for binary packets
encodePacket(packet, false, encodedPacket => {
encodePacket(packet, false, (encodedPacket) => {
encodedPackets[i] = encodedPacket;

@@ -34,5 +34,6 @@ if (++count === length) {

export function createPacketEncoderStream() {
// @ts-expect-error
return new TransformStream({
transform(packet, controller) {
encodePacketToBinary(packet, encodedPacket => {
encodePacketToBinary(packet, (encodedPacket) => {
const payloadLength = encodedPacket.length;

@@ -64,3 +65,3 @@ let header;

});
}
},
});

@@ -98,2 +99,3 @@ }

let isBinary = false;
// @ts-expect-error
return new TransformStream({

@@ -156,6 +158,6 @@ transform(chunk, controller) {

}
}
},
});
}
export const protocol = 4;
export { encodePacket, encodePayload, decodePacket, decodePayload };
export { encodePacket, encodePayload, decodePacket, decodePayload, };

@@ -5,3 +5,3 @@ {

"license": "MIT",
"version": "5.2.1",
"version": "5.2.2",
"main": "./build/cjs/index.js",

@@ -25,3 +25,3 @@ "module": "./build/esm/index.js",

"nyc": "~15.0.1",
"prettier": "^1.19.1",
"prettier": "^3.2.5",
"rimraf": "^3.0.2",

@@ -28,0 +28,0 @@ "socket.io-browsers": "^1.0.4",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc