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

sort-json

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sort-json - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

10

cmd.js

@@ -5,6 +5,12 @@ #!/usr/bin/env node

var path = require('path');
var detectIndent = require('detect-indent');
var filename = path.resolve(process.argv[2]);
var json = JSON.parse(fs.readFileSync(filename));
var file = fs.readFileSync(filename, 'utf8');
// Try to detect the indentation and fall back to two spaces if unable.
var indent = detectIndent(file).indent || ' ';
var json = JSON.parse(file);
var visit = require('./');

@@ -14,2 +20,2 @@

fs.writeFile(filename, JSON.stringify(result, null, ' '));
fs.writeFile(filename, JSON.stringify(result, null, indent));

6

package.json
{
"name": "sort-json",
"version": "1.1.1",
"version": "1.2.0",
"description": "Takes a json-file and return a copy of the same file, but sorted",
"main": "index.js",
"dependencies": {},
"dependencies": {
"detect-indent": "^4.0.0"
},
"bin": {

@@ -8,0 +10,0 @@ "sort-json": "./cmd.js"

@@ -25,2 +25,2 @@ sort-json

For now sort-json takes no other arguments, so the origin file will be overritten by a sorted json file with 2-space indentation.
For now sort-json takes no other arguments, so the original file will be overwritten by a sorted json file, keeping the indentation of the original file.

Sorry, the diff of this file is not supported yet

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