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

read-package-json-fast

Package Overview
Dependencies
Maintainers
5
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

read-package-json-fast - npm Package Compare versions

Comparing version 1.2.1 to 2.0.0

16

index.js

@@ -16,3 +16,3 @@ const {promisify} = require('util')

fixBundled(data)
foldinOptionalDeps(data)
pruneRepeatedOptionals(data)
fixScripts(data)

@@ -32,10 +32,16 @@ fixFunding(data)

const foldinOptionalDeps = data => {
// it was once common practice to list deps both in optionalDependencies
// and in dependencies, to support npm versions that did not know abbout
// optionalDependencies. This is no longer a relevant need, so duplicating
// the deps in two places is unnecessary and excessive.
const pruneRepeatedOptionals = data => {
const od = data.optionalDependencies
const dd = data.dependencies || {}
if (od && typeof od === 'object') {
data.dependencies = data.dependencies || {}
for (const [name, spec] of Object.entries(od)) {
data.dependencies[name] = spec
for (const name of Object.keys(od)) {
delete dd[name]
}
}
if (Object.keys(dd).length === 0)
delete data.dependencies
return data

@@ -42,0 +48,0 @@ }

{
"name": "read-package-json-fast",
"version": "1.2.1",
"version": "2.0.0",
"description": "Like read-package-json, but faster",

@@ -5,0 +5,0 @@ "author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)",

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