Socket
Socket
Sign inDemoInstall

ssb-conn-db

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ssb-conn-db - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

1

lib/index.d.ts

@@ -5,2 +5,3 @@ import { AddressData, Opts } from './types';

private readonly _map?;
private readonly _feedIdMap?;
private readonly _notify?;

@@ -7,0 +8,0 @@ private readonly _writeTimeout;

20

lib/index.js

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

const debug = require('debug')('ssb:conn-db');
const Ref = require('ssb-ref');
const defaultOpts = {

@@ -23,2 +24,3 @@ path: path.join(os.homedir(), '.ssb'),

this._map = new Map();
this._feedIdMap = new Map();
this._notify = Notify();

@@ -97,5 +99,7 @@ this._writeTimeout =

_load(vals) {
const keys = Object.keys(vals);
for (let key of keys) {
this._map.set(key, vals[key]);
for (const [addr, data] of Object.entries(vals)) {
this._map.set(addr, data);
if (data.key && Ref.isFeed(data.key)) {
this._feedIdMap.set(data.key, addr);
}
}

@@ -219,7 +223,7 @@ this._loadedResolve(true);

this._assertNotClosed();
for (let [address, data] of this._map.entries()) {
if (data.key === id)
return address;
}
return undefined;
const address = this._feedIdMap.get(id);
if (address)
return address;
else
return undefined;
}

@@ -226,0 +230,0 @@ has(address) {

{
"name": "ssb-conn-db",
"description": "Module that manages a local registry of connectable peers",
"version": "1.0.2",
"version": "1.0.3",
"homepage": "https://github.com/staltz/ssb-conn-db",

@@ -13,3 +13,3 @@ "main": "lib/index.js",

"dependencies": {
"atomic-file-rw": "^0.2.1",
"atomic-file-rw": "^0.2.2",
"debug": "^4.3.1",

@@ -16,0 +16,0 @@ "multiserver-address": "~1.0.1",

@@ -120,5 +120,4 @@ import * as fs from 'fs';

private _load(vals: Record<string, AddressData>): void {
const keys = Object.keys(vals);
for (let key of keys) {
this._map!.set(key, vals[key]);
for (const [addr, data] of Object.entries(vals)) {
this._map!.set(addr, data);
}

@@ -125,0 +124,0 @@ this._loadedResolve(true);

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