Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

json-text-sequence

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-text-sequence - npm Package Compare versions

Comparing version 2.0.2 to 3.0.0

38

lib/index.js

@@ -1,5 +0,5 @@

import {DelimitedStream} from '@sovpro/delimited-stream'
import {Transform} from 'stream'
import {DelimitedStream} from '@sovpro/delimited-stream';
import {Transform} from 'node:stream';
export const RS = '\x1e'
export const RS = '\x1e';

@@ -50,3 +50,3 @@ // Parse a JSON text sequence stream as defined in

readableObjectMode: true,
})
});
this._stream = new DelimitedStream(RS)

@@ -61,11 +61,11 @@ .on('data', d => {

try {
const j = JSON.parse(d)
this.push(j)
const j = JSON.parse(d);
this.push(j);
} catch (ignored) {
this.emit('invalid', d)
this.emit('invalid', d);
}
} else {
this.emit('truncated', d)
this.emit('truncated', d);
}
})
});
}

@@ -75,3 +75,3 @@

_transform(chunk, encoding, cb) {
this._stream.write(chunk, encoding, cb)
this._stream.write(chunk, encoding, cb);
}

@@ -81,3 +81,3 @@

_final(cb) {
this._stream.end(null, null, cb)
this._stream.end(null, null, cb);
}

@@ -106,17 +106,17 @@ }

writableObjectMode: true,
})
});
}
// @nodoc
_transform(chunk, encoding, cb) {
let s = null
_transform(chunk, _encoding, cb) {
let s = null;
try {
// This can fail on circular objects, for example
s = JSON.stringify(chunk)
s = JSON.stringify(chunk);
} catch (error) {
return cb(error)
return cb(error);
}
this.push(`${RS}${s}\n`, 'utf8')
return cb()
this.push(`${RS}${s}\n`, 'utf8');
return cb();
}

@@ -128,2 +128,2 @@ }

JSONSequenceGenerator as Generator,
}
};
{
"name": "json-text-sequence",
"version": "2.0.2",
"version": "3.0.0",
"description": "Parse and generate RS-delimited JSON sequences according to draft-ietf-json-text-sequence",

@@ -8,12 +8,5 @@ "main": "./lib/index.js",

"types": "types/index.d.ts",
"scripts": {
"clean": "rm -rf coverage",
"test": "c8 ava",
"lint": "eslint . --ext js",
"types": "tsc",
"check": "npm run lint && npm run types && npm run coverage && npm pack --dry-run"
},
"repository": {
"type": "git",
"url": "https://github.com/hildjj/json-text-sequence"
"url": "git+https://github.com/hildjj/json-text-sequence.git"
},

@@ -35,12 +28,2 @@ "keywords": [

},
"devDependencies": {
"@cto.af/eslint-config": "^2.0.3",
"@types/node": "^20.3.3",
"ava": "^5.3.1",
"c8": "8.0.0",
"eslint": "^8.40.0",
"eslint-plugin-ava": "^14.0.0",
"eslint-plugin-n": "16.0.1",
"typescript": "^5.1.6"
},
"pnpm": {

@@ -56,5 +39,6 @@ "overrides": {

},
"packageManager": "pnpm@9.12.2",
"engines": {
"node": ">=16"
"node": ">=18"
}
}

@@ -66,2 +66,2 @@ # json-text-sequence

[![Tests](https://github.com/hildjj/json-text-sequence/workflows/Tests/badge.svg)](https://github.com/hildjj/json-text-sequence/actions?query=workflow%3ATests)
[![Coverage Status](https://coveralls.io/repos/hildjj/json-text-sequence/badge.png?branch=main)](https://coveralls.io/r/hildjj/json-text-sequence?branch=main)
[![codecov](https://codecov.io/gh/hildjj/json-text-sequence/graph/badge.svg?token=eBBBlbwJLl)](https://codecov.io/gh/hildjj/json-text-sequence)

@@ -8,6 +8,6 @@ export const RS: "\u001E";

export class JSONSequenceGenerator extends Transform {
_transform(chunk: any, encoding: any, cb: any): any;
_transform(chunk: any, _encoding: any, cb: any): any;
}
import { Transform } from 'stream';
import { Transform } from 'node:stream';
import { DelimitedStream } from '@sovpro/delimited-stream';
export { JSONSequenceParser as Parser, JSONSequenceGenerator as Generator };
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