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

json

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json - npm Package Compare versions

Comparing version 0.0.12 to 0.0.13

12

lib/jsonCommand.js

@@ -17,2 +17,3 @@ var util = require("util"),

this.uglyOutput = false;
this.leadingComma = false;
this.inspectOutput = false;

@@ -44,2 +45,3 @@ this.headerPassthrough = false;

console.log(" -u print ugly json output, each object on a single line\n");
console.log(" -, print leading-comma diff-friendly output, one line per property\n");
console.log(" -d print debugging output including exception messages\n");

@@ -83,2 +85,3 @@ console.log(" -o object.path specify the path to an array to be iterated on\n");

return( this.inspectOutput ? util.inspect(obj, false, Infinity, true)
: this.leadingComma ? this.diffFriendly(obj)
: this.uglyOutput ? JSON.stringify(obj)

@@ -88,2 +91,8 @@ : JSON.stringify(obj, null, 2) );

JSON.Command.prototype.diffFriendly = function(obj) {
return JSON.stringify(obj, null, 2)
.replace(/ ?([[{,])\n ( *)(?: )/gm, '\n$2$1 ')
.replace(/(^|, ?)\n *{/gm, '$1{');
};
JSON.Command.prototype.debug = function(msg) {

@@ -136,2 +145,5 @@ if (this.debugOn) { console.log(msg); }

break;
case "-,": // diff-friendlier output
this.leadingComma = true;
break;
case "-c": // conditional

@@ -138,0 +150,0 @@ this.conditionals.push(a.shift());

4

package.json
{ "name": "json"
, "version": "0.0.12"
, "version": "0.0.13"
, "engines": [ "node >=0.4.0" ]
, "description": "JSON command line processing toolkit."
, "author": "Zachary Poley <zpoley@gmail.com> (http://zpoley.net)"
, "contributors": [ "Isaac Schlueter <i@izs.me> (http://blog.izs.me)", "Andrey Tarantsov <andreyvit@gmail.com> (http://www.tarantsov.com/)", "Niek Schmoller <niek.schmoller@helderberg.nl> (http://helderberg.nl)", "Ryunosuke SATO (http://d.hatena.ne.jp/tricknotes/)" ]
, "contributors": [ "Isaac Schlueter <i@izs.me> (http://blog.izs.me)", "Andrey Tarantsov <andreyvit@gmail.com> (http://www.tarantsov.com/)", "Niek Schmoller <niek.schmoller@helderberg.nl> (http://helderberg.nl)", "Ryunosuke SATO (http://d.hatena.ne.jp/tricknotes/)", "Johan Sundström (http://ecmanaut.blogspot.com/)" ]
, "keywords" : [ "json", "command", "shell" ]

@@ -8,0 +8,0 @@ , "man" : "./man/json.1"

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