read-package-json
Advanced tools
Comparing version 0.1.8 to 0.1.9
{ | ||
"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) |
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
34159
10
694
4