Comparing version 0.4.0 to 0.5.0
16
index.js
@@ -194,10 +194,12 @@ var fs = require('fs'), | ||
path.forEach(function(path) { | ||
var data = load(path, options), | ||
filename; | ||
if (fs.existsSync(path)) { | ||
var data = load(path, options), | ||
filename; | ||
if (options.merge) { | ||
exports.extend(true, conf, data); | ||
} else { | ||
filename = Path.basename(path, options.ext); | ||
conf[filename] = data; | ||
if (options.merge) { | ||
exports.extend(true, conf, data); | ||
} else { | ||
filename = Path.basename(path, options.ext); | ||
conf[filename] = data; | ||
} | ||
} | ||
@@ -204,0 +206,0 @@ }); |
{ | ||
"name": "cjson", | ||
"description": "cjson - Commented JavaScript Object Notation. It is a json loader, which parses only valid json files, but with comments enabled. Useful for loading configs.", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"repository": "git://github.com/kof/node-cjson.git", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -85,2 +85,12 @@ var a = require('assert'); | ||
a.deepEqual( | ||
cjson.load([ | ||
fixtures + '/conf1.json', | ||
'missing-conf.json', | ||
fixtures + '/conf6.json' | ||
], true), | ||
data2, | ||
'load a missing config file among an array of config files and merge them' | ||
); | ||
a.deepEqual(cjson.load(fixtures, {ext: '.cjson'}), {conf9: {a: 1}}, 'use custom ext'); | ||
@@ -87,0 +97,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
18222
383