New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@d-fischer/connection

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@d-fischer/connection - npm Package Compare versions

Comparing version 1.0.3 to 2.0.0

13

es/Connection.js

@@ -6,9 +6,10 @@ import { __awaiter, __extends, __generator } from "tslib";

function Connection(_a) {
var hostName = _a.hostName, port = _a.port, secure = _a.secure;
var hostName = _a.hostName, port = _a.port, secure = _a.secure, lineBased = _a.lineBased;
var _this = _super.call(this) || this;
_this._currentLine = '';
_this._connecting = false;
_this._connected = false;
_this._manualDisconnect = false;
_this._currentLine = '';
_this._secure = Boolean(secure);
_this._lineBased = Boolean(lineBased);
if (port) {

@@ -54,10 +55,14 @@ _this._host = hostName;

Connection.prototype.receiveRaw = function (data) {
if (!this._lineBased) {
this.emit('receive', data);
return;
}
var receivedLines = data.split('\r\n');
this._currentLine += receivedLines.shift() || '';
if (receivedLines.length) {
this.emit('lineReceived', this._currentLine);
this.emit('receive', this._currentLine);
this._currentLine = receivedLines.pop() || '';
for (var _i = 0, receivedLines_1 = receivedLines; _i < receivedLines_1.length; _i++) {
var line = receivedLines_1[_i];
this.emit('lineReceived', line);
this.emit('receive', line);
}

@@ -64,0 +69,0 @@ }

@@ -7,15 +7,14 @@ /// <reference types="node" />

secure?: boolean;
reconnect?: boolean;
pingOnInactivity?: number;
pingTimeout?: number;
lineBased?: boolean;
}
declare abstract class Connection extends EventEmitter {
protected _host: string;
protected _port?: number;
protected _secure: boolean;
protected readonly _host: string;
protected readonly _port?: number;
protected readonly _secure: boolean;
private readonly _lineBased;
private _currentLine;
protected _connecting: boolean;
protected _connected: boolean;
protected _manualDisconnect: boolean;
private _currentLine;
constructor({ hostName, port, secure }: ConnectionInfo);
constructor({ hostName, port, secure, lineBased }: ConnectionInfo);
connect(): Promise<void>;

@@ -22,0 +21,0 @@ disconnect(manually?: boolean): void;

@@ -8,9 +8,10 @@ "use strict";

function Connection(_a) {
var hostName = _a.hostName, port = _a.port, secure = _a.secure;
var hostName = _a.hostName, port = _a.port, secure = _a.secure, lineBased = _a.lineBased;
var _this = _super.call(this) || this;
_this._currentLine = '';
_this._connecting = false;
_this._connected = false;
_this._manualDisconnect = false;
_this._currentLine = '';
_this._secure = Boolean(secure);
_this._lineBased = Boolean(lineBased);
if (port) {

@@ -56,10 +57,14 @@ _this._host = hostName;

Connection.prototype.receiveRaw = function (data) {
if (!this._lineBased) {
this.emit('receive', data);
return;
}
var receivedLines = data.split('\r\n');
this._currentLine += receivedLines.shift() || '';
if (receivedLines.length) {
this.emit('lineReceived', this._currentLine);
this.emit('receive', this._currentLine);
this._currentLine = receivedLines.pop() || '';
for (var _i = 0, receivedLines_1 = receivedLines; _i < receivedLines_1.length; _i++) {
var line = receivedLines_1[_i];
this.emit('lineReceived', line);
this.emit('receive', line);
}

@@ -66,0 +71,0 @@ }

{
"name": "@d-fischer/connection",
"version": "1.0.3",
"version": "2.0.0",
"description": "Abstraction for packet-based connections.",

@@ -5,0 +5,0 @@ "keywords": [],

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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