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 0.0.1 to 1.0.0

index.js

12

cmd.js

@@ -10,13 +10,3 @@ #!/usr/bin/env node

function visit(old) {
if (Array.isArray(old) || typeof(old) !== 'object') {
return old;
}
var sorted = {};
var keys = Object.keys(old).sort();
keys.forEach(function(key) {
sorted[key] = visit(old[key]);
});
return sorted;
}
var visit = require('./');

@@ -23,0 +13,0 @@ var result = visit(json);

{
"name": "sort-json",
"version": "0.0.1",
"version": "1.0.0",
"description": "Takes a json-file and return a copy of the same file, but sorted",
"main": "cmd.js",
"main": "index.js",
"dependencies": {},

@@ -14,6 +14,12 @@ "bin": {

},
"repository": "",
"repository": {
"type": "git",
"url": "https://github.com/kesla/sort-json.git"
},
"author": "David Björklund <david.bjorklund@gmail.com>",
"license": "MIT",
"preferGlobal": true
"bugs": {
"url": "https://github.com/kesla/sort-json/issues"
},
"homepage": "https://github.com/kesla/sort-json"
}
sort-json
=========
Takes a json-file and return a copy of the same file, but sorted
Takes a json-file and return a copy of the same file, but with the keys sorted

@@ -11,6 +11,16 @@ installation

usage
-----
```js
var sortJson = require('sort-json');
var copy = sortJson(object);
```
CLI usage
---------
`sort-json file.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.
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