Socket
Socket
Sign inDemoInstall

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.8 to 0.1.9

test/bom.js

2

package.json
{
"name": "read-package-json",
"version": "0.1.8",
"version": "0.1.9",
"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",

@@ -83,2 +83,14 @@ // vim: set softtabstop=16 shiftwidth=16:

function stripBOM(content) {
// Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
// because the buffer-to-string conversion in `fs.readFileSync()`
// translates it to FEFF, the UTF-16 BOM.
if (content.charCodeAt(0) === 0xFEFF) {
content = content.slice(1);
}
return content;
}
function parseJson (file, er, d, cb) {

@@ -91,3 +103,3 @@ if (er && er.code === "ENOENT") {

try {
d = JSON.parse(d)
d = JSON.parse(stripBOM(d))
} catch (er) {

@@ -94,0 +106,0 @@ d = parseIndex(d)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc