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

read-package-json

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

read-package-json - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

test/fixtures/not-json.css

2

package.json
{
"name": "read-package-json",
"version": "0.1.1",
"version": "0.1.2",
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",

@@ -5,0 +5,0 @@ "description": "The thing npm uses to read package.json files with semantics and defaults and validation",

@@ -79,18 +79,22 @@ // vim: set softtabstop=16 shiftwidth=16:

fs.readFile(file, "utf8", function (er, d) {
if (er && er.code === "ENOENT") {
indexjs(file, er, cb)
return
}
if (er) return cb(er);
try {
d = JSON.parse(d)
} catch (er) {
er = parseError(er, file);
return cb(er);
}
extras(file, d, cb)
parseJson(file, er, d, cb)
})
}
function parseJson (file, er, d, cb) {
if (er && er.code === "ENOENT") {
indexjs(file, er, cb)
return
}
if (er) return cb(er);
try {
d = JSON.parse(d)
} catch (er) {
d = parseIndex(d)
if (!d) return cb(parseError(er, file));
}
extras(file, d, cb)
}
function indexjs (file, er, cb) {

@@ -230,3 +234,3 @@ if (path.basename(file) === "index.js") {

if (er) return cb(er);
if (!files.length) return cb()
if (!files.length) return cb();
var rm = path.resolve(dir, files[0])

@@ -334,4 +338,2 @@ readme_(file, data, rm, cb)

function typoWarn (file, data) {
if (typoWarned[data._id]) return;
typoWarned[data._id] = true
if (data.modules) {

@@ -348,2 +350,3 @@ warn(file, data,

noreadmeWarn(file, data)
typoWarned[data._id] = true
}

@@ -492,2 +495,3 @@

function warn (f, d, m) {
if (typoWarned[d._id]) return;
readJson.log.warn("package.json", d._id, m)

@@ -494,0 +498,0 @@ }

@@ -0,1 +1,2 @@

// vim: set softtabstop=16 shiftwidth=16:
var tap = require("tap")

@@ -2,0 +3,0 @@ var readJson = require("../")

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