Comparing version 0.0.1 to 1.0.0
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. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
1706
5
18
0
1
25
2