Socket
Socket
Sign inDemoInstall

@akiroz/thalamus

Package Overview
Dependencies
50
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.0 to 0.3.1

2

dist/dispatcher.d.ts

@@ -6,3 +6,3 @@ declare type Handler = (msg: Uint8Array, topic: string) => any;

add([head, ...rest]: string[], h: Handler): void;
rm([head, ...rest]: string[], h?: Handler): void;
rm([head, ...rest]: string[], h?: Handler): boolean;
get([head, ...rest]: string[]): Handler[];

@@ -9,0 +9,0 @@ }

@@ -64,7 +64,8 @@ "use strict";

}
else if (this.paths.has(head)) {
this.paths.get(head).rm(rest, h);
if (this.paths.get(head).handlers.size < 1)
if (this.paths.has(head)) {
var empty = this.paths.get(head).rm(rest, h);
if (empty)
this.paths.delete(head);
}
return this.handlers.size < 1 && this.paths.size < 1;
};

@@ -71,0 +72,0 @@ Node.prototype.get = function (_a) {

{
"name": "@akiroz/thalamus",
"version": "0.3.0",
"version": "0.3.1",
"repository": "github:akiroz/Thalamus",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -5,3 +5,7 @@ import "ts-mocha";

import assert from "assert";
import { inspect } from "util";
// Dump node tree
// console.log(inspect(node, { depth: null }));
describe("Dispatcher", () => {

@@ -49,5 +53,11 @@ const h = () => {};

node.add(["a", "b", "c"], h);
node.add(["a", "+", "c"], h2);
node.add(["a", "b", "c"], h2);
node.rm(["a", "b", "c"], h);
assert.deepStrictEqual([h2], node.get(["a", "b", "c"]));
});
it("remove all handler", () => {
node.add(["a", "b", "c"], h);
node.add(["a", "b", "c"], h2);
node.rm(["a", "b", "c"]);
node.rm(["a", "+", "c"]);
assert.deepStrictEqual([], node.get(["a", "b", "c"]));

@@ -54,0 +64,0 @@ });

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc