Comparing version 0.1.0 to 0.2.0
16
index.js
var fs = require("fs"); | ||
var call = require("try-call"); | ||
@@ -6,3 +7,3 @@ module.exports = readJSON; | ||
function readJSON(filename, options, callback){ | ||
if(callback === undefined){ | ||
if(arguments.length == 2){ | ||
callback = options; | ||
@@ -14,12 +15,9 @@ options = {}; | ||
if(error) return callback(error); | ||
call(parse.bind(null, bf), callback); | ||
}); | ||
try { | ||
bf = JSON.parse(bf.toString().replace(/^\ufeff/g, '')); | ||
} catch (err) { | ||
callback(err); | ||
return; | ||
} | ||
function parse (bf) { | ||
return JSON.parse(bf.toString().replace(/^\ufeff/g, '')); | ||
} | ||
callback(undefined, bf); | ||
}); | ||
} |
{ | ||
"name": "read-json", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Reads and parses a JSON file.", | ||
@@ -17,3 +17,6 @@ "main": "index.js", | ||
"author": "Azer Koçulu <azer@kodfabrik.com>", | ||
"license": "BSD" | ||
"license": "BSD", | ||
"dependencies": { | ||
"try-call": "0.0.0" | ||
} | ||
} |
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
1156
1
16
+ Addedtry-call@0.0.0
+ Addedtry-call@0.0.0(transitive)