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

stream-json

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stream-json - npm Package Compare versions

Comparing version 0.0.5 to 0.1.0

tests/test_escaped.js

2

package.json
{
"name": "stream-json",
"version": "0.0.5",
"version": "0.1.0",
"description": "stream-json is a collection of node.js 0.10 stream components for creating custom standard-compliant JSON processors, which requires a minimal memory footprint. It can parse JSON files far exceeding available memory. Even individual data items are streamed piece-wise. Streaming SAX-inspired event-based API is included as well.",

@@ -5,0 +5,0 @@ "homepage": "http://github.com/uhop/stream-json",

@@ -69,2 +69,4 @@ # stream-json [![Build Status](https://secure.travis-ci.org/uhop/stream-json.png?branch=master)](http://travis-ci.org/uhop/stream-json)

If you want to catch parsing errors, attach an error listener directly to a parser component — unlike data errors do not travel through stream pipes.
### Streamer

@@ -71,0 +73,0 @@

@@ -5,2 +5,15 @@ var util = require("util");

// utilities
// long hexadecimal codes: \uXXXX
function fromHex(s){
return String.fromCharCode(parseInt(s.slice(2), 16));
}
// short codes: \b \f \n \r \t \" \\ \/
var codes = {b: "\b", f: "\f", n: "\n", r: "\r", t: "\t", '"': '"', "\\": "\\", "/": "/"};
// Streamer
function Streamer(options){

@@ -80,5 +93,8 @@ Transform.call(this, options);

case "plainChunk": // string fragments
case "escapedChunk":
this.push({name: "stringChunk", value: chunk.value});
break;
case "escapedChars":
this.push({name: "stringChunk", value:
chunk.value.length == 2 ? codes[chunk.value.charAt(1)] : fromHex(chunk.value)});
break;
default: // white space, punctuations

@@ -85,0 +101,0 @@ if(this._state === "number"){

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