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.8.1 to 0.9.0

4

History.md

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

### 0.9.0 — *October 4, 2013*
* Checks for hasOwnProperty in function render (by @dlight)
### 0.8.1 — *March 11, 2013*

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

28

lib/prettyjson.js

@@ -114,16 +114,18 @@ // Package for formatting JSON data in a coloured

for(var i in data) {
// Prepend the index at the beginning of the line
key = Utils.indent(indentation) + (i + ': ')[options.keysColor];
if (data.hasOwnProperty(i)) {
// Prepend the index at the beginning of the line
key = Utils.indent(indentation) + (i + ': ')[options.keysColor];
// If the value is serializable, render it in the same line
if (isSerializable(data[i])) {
key += exports.render(data[i], options, maxIndexLength - i.length);
output.push(key);
// If the value is serializable, render it in the same line
if (isSerializable(data[i])) {
key += exports.render(data[i], options, maxIndexLength - i.length);
output.push(key);
// If the index is an array or object, render it in next line
} else {
output.push(key);
output.push(
exports.render(data[i], options, indentation + options.defaultIndentation)
);
// If the index is an array or object, render it in next line
} else {
output.push(key);
output.push(
exports.render(data[i], options, indentation + options.defaultIndentation)
);
}
}

@@ -185,2 +187,2 @@ }

return output;
};
};

@@ -18,3 +18,3 @@ "use strict";

for (key in input) {
if (key.length > maxWidth) {
if (input.hasOwnProperty(key) && key.length > maxWidth) {
maxWidth = key.length;

@@ -24,2 +24,2 @@ }

return maxWidth;
};
};

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

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

@@ -32,3 +32,3 @@ "keywords": [

"devDependencies": {
"releasetools": "0.4.0",
"releasetools": "0.4.1",
"step": "0.0.5",

@@ -38,4 +38,5 @@ "mocha": "1.8.1",

"jake": "0.5.9",
"jshint": "1.1.0"
"jshint": "1.1.0",
"jscoverage": "0.3.8"
}
}
}

@@ -1,4 +0,4 @@

# prettyjson [![Build Status](https://secure.travis-ci.org/rafeca/prettyjson.png)](http://travis-ci.org/rafeca/prettyjson)
# prettyjson [![Build Status](https://secure.travis-ci.org/rafeca/prettyjson.png)](http://travis-ci.org/rafeca/prettyjson) [![NPM version](https://badge.fury.io/js/prettyjson.png)](http://badge.fury.io/js/prettyjson)
Package for formatting JSON data in a coloured YAML-style, perfect for CLI output
Package for formatting JSON data in a coloured YAML-style, perfect for CLI output.

@@ -116,2 +116,2 @@ ## How to install

You can check the package's [test coverage](http://rafeca.com/prettyjson/coverage.html) if you are one of those test paranoics
You can check the package's [test coverage](http://rafeca.com/prettyjson/coverage.html) if you are one of those test paranoics

@@ -167,2 +167,17 @@ var prettyjson = process.env.EXPRESS_COV ? require('../lib-cov/prettyjson') : require('../lib/prettyjson');

});
it("should not print an object prototype", function() {
var Input = function() {
this.param1 = 'first string';
this.param2 = 'second string';
};
Input.prototype = {randomProperty: 'idontcare'};
var output = prettyjson.render(new Input);
output.should.equal([
'param1: '.green + 'first string',
'param2: '.green + 'second string'
].join('\n'));
});
});

@@ -236,2 +251,2 @@

});
});
});

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

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