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

sort-package-json

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sort-package-json - npm Package Compare versions

Comparing version 1.38.3 to 1.39.0

2

index.d.ts

@@ -32,3 +32,3 @@ /* eslint-disable @typescript-eslint/no-explicit-any */

packageJson: T,
options?: sortPackageJson.Options
options?: sortPackageJson.Options,
): T

@@ -35,0 +35,0 @@

@@ -18,3 +18,15 @@ const sortObjectKeys = require('sort-object-keys')

const onObject = fn => x => (isPlainObject(x) ? fn(x) : x)
const sortObjectBy = comparator => onObject(x => sortObjectKeys(x, comparator))
const sortObjectBy = (comparator, deep) => {
const over = onObject(object => {
object = sortObjectKeys(object, comparator)
if (deep) {
for (const [key, value] of Object.entries(object)) {
object[key] = over(value)
}
}
return object
})
return over
}
const sortObject = sortObjectBy()

@@ -231,2 +243,4 @@ const sortURLObject = sortObjectBy(['type', 'url'])

{ key: 'peerDependencies', over: sortObject },
// TODO: only sort depth = 2
{ key: 'peerDependenciesMeta', over: sortObjectBy(undefined, true) },
{ key: 'optionalDependencies', over: sortObject },

@@ -233,0 +247,0 @@ { key: 'bundledDependencies', over: uniqAndSortArray },

{
"name": "sort-package-json",
"version": "1.38.3",
"version": "1.39.0",
"description": "Sort an Object or package.json based on the well-known package.json keys",

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

"hooks": {
"pre-commit": "npm t",
"pre-commit": "npm t && lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"

@@ -47,2 +47,16 @@ }

},
"lint-staged": {
"*.js": [
"eslint --fix",
"git add"
],
"*.ts": [
"prettier --write",
"git add"
],
"package.json": [
"node cli.js",
"git add"
]
},
"prettier": {

@@ -85,8 +99,9 @@ "semi": false,

"husky": "^4.0.2",
"lint-staged": "^9.5.0",
"make-dir": "3.0.0",
"nyc": "^15.0.0",
"prettier": "^1.19.1",
"semantic-release": "16.0.0",
"semantic-release": "16.0.1",
"tempy": "0.3.0"
}
}
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