yaml-or-json
Advanced tools
Comparing version 0.1.0 to 0.2.0
11
index.js
@@ -5,2 +5,3 @@ 'use strict'; | ||
var yaml = require('js-yaml'); | ||
var json5 = require('json5'); | ||
@@ -14,3 +15,3 @@ var opts = { | ||
return fs.readFileSync(filePath, opts); | ||
} catch(e) { | ||
} catch (e) { | ||
return undefined; | ||
@@ -33,5 +34,11 @@ } | ||
return require(path + '.json'); | ||
content = readFile(path + '.json'); | ||
if (typeof content !== 'undefined') { | ||
return json5.parse(content); | ||
} | ||
throw new Error('no config file found'); | ||
} | ||
module.exports = yamlOrJSON; |
{ | ||
"name": "yaml-or-json", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Requires a yaml or json config file depending on what it finds.", | ||
@@ -9,2 +9,5 @@ "main": "index.js", | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"repository": { | ||
@@ -33,3 +36,4 @@ "type": "git", | ||
"dependencies": { | ||
"js-yaml": "^3.4.0" | ||
"js-yaml": "^3.4.0", | ||
"json5": "^0.4.0" | ||
}, | ||
@@ -36,0 +40,0 @@ "devDependencies": { |
@@ -30,4 +30,9 @@ # yaml-or-json | ||
## JSON5 is supported! | ||
JSON files are parsed by [JSON5 parser](https://www.npmjs.com/package/json5). | ||
## License | ||
The MIT License (MIT) |
Sorry, the diff of this file is not supported yet
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
38
1
0
3642
2
4
30
+ Addedjson5@^0.4.0
+ Addedjson5@0.4.0(transitive)