Comparing version 0.0.11 to 0.0.12
21
etc.js
@@ -94,3 +94,3 @@ var util = require('util'); | ||
Etc.prototype.file = function(file, named) { | ||
Etc.prototype.file = function(file, named, baseDir) { | ||
if (existsSync(file)) { | ||
@@ -101,5 +101,12 @@ var ext = path.extname(file).substr(1); | ||
if (named) { | ||
var name = path.basename(file, path.extname(file)); | ||
var obj = {}; | ||
obj[name] = parsed; | ||
var parts = file.substr(baseDir.length).replace(/^\//, '').split('/'), | ||
obj = {}; | ||
parts.reduce(function(prev, next, i) { | ||
var last = (i === parts.length - 1); | ||
var name = last ? path.basename(next, path.extname(next)) : next; | ||
prev[name] = last ? parsed : {}; | ||
return prev[next]; | ||
}, obj); | ||
this.push(obj); | ||
@@ -117,6 +124,6 @@ } | ||
var self = this; | ||
var files = glob.sync(dir + '/*.*'); | ||
var files = glob.sync(dir + '/**/*.*'); | ||
files.forEach(function(file) { | ||
var name = path.basename(file, path.extname(file)); | ||
self.file(file, name.indexOf('conf') !== 0); | ||
var rel = file.substr(dir.length).replace(/^\//, ''); | ||
self.file(file, rel.indexOf('conf') !== 0, dir); | ||
}); | ||
@@ -123,0 +130,0 @@ }; |
{ | ||
"name": "etc", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "Configuration loader for node.js applications", | ||
@@ -5,0 +5,0 @@ "main": "etc.js", |
@@ -45,2 +45,3 @@ var etc = require('../'), | ||
assert.deepEqual(conf.get('meat'), {red: {steak: "ribeye"}}); | ||
assert.deepEqual(conf.get('drinks'), {cold: {soda: 'coke'}, hot: {coffee: 'french roast'}}); | ||
}); | ||
@@ -47,0 +48,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
14084
17
240
0
1