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

json-lines

Package Overview
Dependencies
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-lines - npm Package Compare versions

Comparing version 0.4.3 to 1.0.0

dist/jsonLines.js

2

lib/jsonLines.js
'use strict';
const jsonLines = require('./route')(90);
const jsonLines = require('./route')({ heartbeatInterval: 90 });
module.exports = jsonLines;
'use strict';
const events = require('events'),
util = require('util');
const { EventEmitter } = require('events');
const EventEmitter = events.EventEmitter;
class Client extends EventEmitter {
constructor (req, res) {
super();
this.req = req;
this.res = res;
}
const Client = function (req, res) {
this.req = req;
this.res = res;
};
send (data) {
if (typeof data !== 'object') {
throw new Error('Data must be an object.');
}
if (data === null) {
throw new Error('Data must not be null.');
}
util.inherits(Client, EventEmitter);
Client.prototype.send = function (data) {
if (typeof data !== 'object') {
throw new Error('Data must be an object.');
try {
this.res.write(`${JSON.stringify(data)}\n`);
} catch (ex) {
if (ex.message === 'write after end') {
// Ignore write after end errors. This simply means that the connection
// was closed concurrently, and we can't do anything about it anyway.
// Hence, simply return.
return;
}
throw ex;
}
}
if (data === null) {
throw new Error('Data must not be null.');
}
try {
this.res.write(`${JSON.stringify(data)}\n`);
} catch (ex) {
if (ex.message === 'write after end') {
// Ignore write after end errors. This simply means that the connection
// was closed concurrently, and we can't do anything about it anyway.
// Hence, simply return.
return;
}
throw ex;
disconnect () {
this.res.end();
this.res.removeAllListeners();
}
};
}
Client.prototype.disconnect = function () {
this.res.end();
this.res.removeAllListeners();
};
module.exports = Client;

@@ -7,4 +7,4 @@ 'use strict';

const setupRoute = function (timeout) {
const heartbeatTimer = new Timer(timeout * 1000);
const setupRoute = function ({ heartbeatInterval }) {
const heartbeatTimer = new Timer(heartbeatInterval * 1000);

@@ -11,0 +11,0 @@ const route = function (callback) {

{
"name": "json-lines",
"version": "0.4.3",
"version": "1.0.0",
"description": "json-lines streams JSON Lines.",

@@ -13,13 +13,18 @@ "contributors": [

"email": "matthias.wagler@thenativeweb.io"
},
{
"name": "Jan-Hendrik Grundhöfer",
"email": "jan-hendrik.grundhoefer@thenativeweb.io"
}
],
"main": "lib/jsonLines.js",
"main": "dist/jsonLines.js",
"dependencies": {
"timer2": "0.2.3"
"timer2": "1.0.0"
},
"devDependencies": {
"assertthat": "0.7.0",
"body-parser": "1.15.1",
"express": "4.13.4",
"roboter": "0.8.1"
"assertthat": "1.0.0",
"body-parser": "1.18.2",
"express": "4.16.2",
"roboter": "0.15.6",
"roboter-server": "0.15.6"
},

@@ -26,0 +31,0 @@ "repository": {

@@ -7,3 +7,3 @@ # json-lines

```bash
```shell
$ npm install json-lines

@@ -73,4 +73,2 @@ ```

**Please note that json-lines 0.4.0 is not backwards-compatible. You must use [json-lines-client](https://www.npmjs.com/package/json-lines-client) 0.6.0 or higher.**
## Running the build

@@ -80,4 +78,4 @@

```bash
$ bot build-server
```shell
$ bot
```

@@ -88,3 +86,3 @@

The MIT License (MIT)
Copyright (c) 2015-2016 the native web.
Copyright (c) 2015-2018 the native web.

@@ -91,0 +89,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@@ -9,9 +9,52 @@ 'use strict';

task('universal/analyze', {
src: [ '**/*.js', '!node_modules/**/*.js', '!coverage/**/*.js' ]
src: [ '**/*.js', '!node_modules/**/*.js', '!coverage/**/*.js', '!dist/**/*.js' ]
});
task('universal/test-units', {
src: 'test/**/*Tests.js'
task('universal/release', {
createDistribution: true
});
task('universal/license', {
compatible: [
// Individual licenses
'Apache-2.0', 'Apache-2.0*',
'BSD-2-Clause', 'BSD-3-Clause',
'ISC',
'MIT', 'MIT*', 'MIT/X11',
'MIT Licensed. http://www.opensource.org/licenses/mit-license.php',
'Public Domain',
'Unlicense',
// Combined licenses
'(Apache-2.0 OR MPL-1.1)',
'BSD-3-Clause OR MIT',
'(MIT AND CC-BY-3.0)',
'(MIT OR Apache-2.0)',
'(WTFPL OR MIT)'
],
ignore: {
// BSD-3-Clause, see https://github.com/deoxxa/duplexer2/blob/0.0.2/LICENSE.md
duplexer2: '0.0.2',
// BSD-3-Clause, see https://github.com/estools/esquery/blob/v1.0.0/license.txt
esquery: '1.0.0',
// MIT, see https://github.com/mklabs/node-fileset/blob/v0.2.1/LICENSE-MIT
fileset: '0.2.1',
// MIT, https://github.com/tarruda/has/blob/1.0.1/package.json
has: '1.0.1',
// BSD-2-Clause, see https://github.com/facebook/regenerator/blob/30d34536b9e3f7a2873b04a16ec66fec9c8246f6/LICENSE
'regenerator-transform': '0.10.1',
// BSD-2-Clause, see https://github.com/jviereck/regjsparser/blob/0.1.5/LICENSE.BSD
regjsparser: '0.1.5',
// MIT, see https://github.com/eugeneware/unique-stream/blob/v1.0.0/LICENSE
'unique-stream': '1.0.0'
}
});
}).
start();
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