diff --git a/package-lock.json b/package-lock.json index d86937b..d425273 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,11 +6,11 @@ "packages": { "": { "name": "@socket.io/redis-emitter", - "version": "4.1.0", + "version": "4.1.1", "license": "MIT", "dependencies": { "debug": "~4.3.1", - "notepack.io": "~2.1.0", + "notepack.io": "~3.0.1", "socket.io-parser": "~4.0.4" }, "devDependencies": { @@ -1957,9 +1957,9 @@ } }, "node_modules/notepack.io": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/notepack.io/-/notepack.io-2.1.3.tgz", - "integrity": "sha512-AgSt+cP5XMooho1Ppn8NB3FFaVWefV+qZoZncYTUSch2GAEwlYLcIIbT5YVkMlFeNHnfwOvc4HDlbvrB5BRxXA==" + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/notepack.io/-/notepack.io-3.0.1.tgz", + "integrity": "sha512-TKC/8zH5pXIAMVQio2TvVDTtPRX+DJPHDqjRbxogtFiByHyzKmy96RA0JtCQJ+WouyyL4A10xomQzgbUT+1jCg==" }, "node_modules/nyc": { "version": "15.1.0", @@ -4374,9 +4374,9 @@ "dev": true }, "notepack.io": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/notepack.io/-/notepack.io-2.1.3.tgz", - "integrity": "sha512-AgSt+cP5XMooho1Ppn8NB3FFaVWefV+qZoZncYTUSch2GAEwlYLcIIbT5YVkMlFeNHnfwOvc4HDlbvrB5BRxXA==" + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/notepack.io/-/notepack.io-3.0.1.tgz", + "integrity": "sha512-TKC/8zH5pXIAMVQio2TvVDTtPRX+DJPHDqjRbxogtFiByHyzKmy96RA0JtCQJ+WouyyL4A10xomQzgbUT+1jCg==" }, "nyc": { "version": "15.1.0", diff --git a/package.json b/package.json index 352c937..7abeb3d 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ }, "dependencies": { "debug": "~4.3.1", - "notepack.io": "~2.1.0", + "notepack.io": "~3.0.1", "socket.io-parser": "~4.0.4" }, "devDependencies": { diff --git a/test/index.ts b/test/index.ts index 5cda7c5..9171465 100644 --- a/test/index.ts +++ b/test/index.ts @@ -96,6 +96,34 @@ describe("emitter", () => { }); }); + it("should support the toJSON() method", (done) => { + // @ts-ignore + BigInt.prototype.toJSON = function () { + return String(this); + }; + + // @ts-ignore + Set.prototype.toJSON = function () { + return [...this]; + }; + + class MyClass { + toJSON() { + return 4; + } + } + + // @ts-ignore + emitter.emit("payload", 1n, new Set(["2", 3]), new MyClass()); + + clientSockets[0].on("payload", (a, b, c) => { + expect(a).to.eql("1"); + expect(b).to.eql(["2", 3]); + expect(c).to.eql(4); + done(); + }); + }); + it("should support all broadcast modifiers", () => { emitter.in(["room1", "room2"]).emit("test"); emitter.except(["room4", "room5"]).emit("test");