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

json-lines-kit

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-lines-kit - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

18

lib/main.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var NEW_LINE = '\n';
var JSONLinesStream = (function () {

@@ -17,10 +16,11 @@ function JSONLinesStream(callback) {

JSONLinesStream.prototype.popLineFromBuffer = function () {
var firstNewLine = this.buffer.indexOf(NEW_LINE) + 1;
if (firstNewLine) {
return;
var firstNewLineCluster = this.buffer.match(/(\n+)/);
if (!firstNewLineCluster) {
return null;
}
var candidateJsonLine = this.buffer.slice(0, firstNewLine).trim();
var firstNewLineBreakPoint = firstNewLineCluster.index + firstNewLineCluster[1].length;
var candidateJsonLine = this.buffer.slice(0, firstNewLineBreakPoint).trim();
try {
var line = JSON.parse(candidateJsonLine);
this.buffer = this.buffer.slice(firstNewLine);
this.buffer = this.buffer.slice(firstNewLineBreakPoint);
return line;

@@ -37,6 +37,8 @@ }

JSONLinesStream.prototype.consumeBuffer = function () {
var line = this.popLineFromBuffer();
var line;
do {
this.emit(line);
line = this.popLineFromBuffer();
if (line) {
this.emit(line);
}
} while (line);

@@ -43,0 +45,0 @@ };

{
"name": "json-lines-kit",
"version": "0.1.0",
"version": "0.2.0",
"description": "Lightweight toolkit for dealing with JSON lines",

@@ -22,5 +22,6 @@ "main": "lib/main.js",

"tsc": "tsc",
"test": "mocha -r ts-node/register src/**/*.spec.ts"
"test": "mocha -r ts-node/register src/**/*.spec.ts",
"prepublish": "tsc"
},
"dependencies": {}
}
# json-lines-kit
[![Build Status](https://travis-ci.com/sourcelair/json-lines-kit.svg?branch=master)](https://travis-ci.com/sourcelair/json-lines-kit)
json-lines-kit is a set of lightweight utilities for dealing with the [JSON Lines format](http://jsonlines.org/).

@@ -4,0 +6,0 @@

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