config-chain
Advanced tools
Comparing version 0.1.1 to 0.2.0
17
index.js
@@ -5,2 +5,3 @@ | ||
, fs = require('fs') | ||
, ini = require('ini') | ||
@@ -39,7 +40,19 @@ var exports = module.exports = function () { | ||
var parse = exports.parse = function (content, file) { | ||
//if it ends in .json or starts with { then it must be json. | ||
//must be done this way, because ini accepts everything. | ||
//can't just try and parse it and let it throw if it's not ini. | ||
//everything is ini. even json with a systax error. | ||
if((file && /\.json$/.test(file)) || /^\s*{/.test(content)) | ||
return JSON.parse(content) | ||
return ini.parse(content) | ||
} | ||
var json = exports.json = function () { | ||
var file = path.join.apply(null, [].slice.call(arguments)) | ||
try { | ||
return JSON.parse(fs.readFileSync(file,'utf-8')) | ||
parse(fs.readFileSync(file,'utf-8'), file) | ||
} catch (err) { | ||
@@ -46,0 +59,0 @@ err.message += ' when attempting to read configuration from:' + file |
@@ -1,12 +0,17 @@ | ||
{ "name": "config-chain" | ||
, "version": "0.1.1" | ||
, "description": "HANDLE CONFIGURATION ONCE AND FOR ALL" | ||
, "homepage": "http://github.com/dominictarr/config-chain" | ||
, "repository": | ||
{ "type": "git" | ||
, "url": "https://github.com/dominictarr/config-chain.git" } | ||
, "dependencies": { | ||
"proto-list": "1" | ||
} | ||
, "author": "Dominic Tarr <dominic.tarr@gmail.com> (http://dominictarr.com)" | ||
{ | ||
"name": "config-chain", | ||
"version": "0.2.0", | ||
"description": "HANDLE CONFIGURATION ONCE AND FOR ALL", | ||
"homepage": "http://github.com/dominictarr/config-chain", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/dominictarr/config-chain.git" | ||
}, | ||
"dependencies": { | ||
"proto-list": "1", | ||
"ini": "~1.0.2" | ||
}, | ||
"bundleDependencies": ["ini"], | ||
"REM": "REMEMBER TO REMOVE BUNDLING WHEN/IF ISAACS MERGES ini#7", | ||
"author": "Dominic Tarr <dominic.tarr@gmail.com> (http://dominictarr.com)" | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
16064
14
226
2
3
1
+ Addedini@~1.0.2