Socket
Socket
Sign inDemoInstall

prettyjson

Package Overview
Dependencies
1
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.7.0 to 0.7.1

4

History.md

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

### 0.7.1 — *October 29, 2012*
* Fix bug in 0.7.0 when input is an array
### 0.7.0 — *October 25, 2012*

@@ -2,0 +6,0 @@

22

lib/prettyjson.js

@@ -1,2 +0,2 @@

// Package for formatting JSON data in a coloured
// Package for formatting JSON data in a coloured
// YAML-style, perfect for CLI output

@@ -89,3 +89,3 @@

var line = Utils.indent(indentation) + ('- ')[options.dashColor];
// If the element of the array is a string, render it in the same line

@@ -110,3 +110,3 @@ if (typeof element === 'string') {

var key;
for(var i in data) {

@@ -151,3 +151,3 @@ // Prepend the index at the beginning of the line

"use strict";
var output = '';

@@ -161,5 +161,13 @@ var parsedData;

// Remove non-JSON characters from the beginning string
if (data.indexOf('{') !== 0) {
output += data.substr(0, data.indexOf('{')) + "\n";
data = data.substr(data.indexOf('{'));
if (data[0] !== '{' && data[0] !== '[') {
var beginingOfJson;
if (data.indexOf('{') === -1) {
beginingOfJson = data.indexOf('[');
} else if (data.indexOf('[') === -1) {
beginingOfJson = data.indexOf('{');
} else {
beginingOfJson = data.indexOf('{') < data.indexOf('[') ? data.indexOf('{') : data.indexOf('[');
}
output += data.substr(0, beginingOfJson) + "\n";
data = data.substr(beginingOfJson);
}

@@ -166,0 +174,0 @@

@@ -5,3 +5,3 @@ {

"description": "Package for formatting JSON data in a coloured YAML-style, perfect for CLI output",
"version": "0.7.0",
"version": "0.7.1",
"homepage": "http://rafeca.com/prettyjson",

@@ -8,0 +8,0 @@ "keywords": [

@@ -217,2 +217,7 @@ var prettyjson = process.env.EXPRESS_COV

});
it('should dismiss trailing characters which are not JSON with an array', function(){
var output = prettyjson.renderString('characters that are not JSON at all... ["test"]');
output.should.equal("characters that are not JSON at all... \n" + '- '.green + 'test');
});
});

Sorry, the diff of this file is not supported yet

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc