From 8e987b8d3da9cc6d0a061ce2062c688d17043ac3 Mon Sep 17 00:00:00 2001 From: Christian Tellnes Date: Sun, 16 Sep 2012 17:45:00 +0200 Subject: [PATCH] make it possible to use other formats than json in common.loadFiles and common.loadFilesSync --- lib/nconf/common.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/nconf/common.js b/lib/nconf/common.js index 2c092e3..f7462f6 100644 --- a/lib/nconf/common.js +++ b/lib/nconf/common.js @@ -58,7 +58,7 @@ common.loadFiles = function (files, callback) { }); } - async.map(files, parseFile, function (err, objs) { + async.map(options.files, parseFile, function (err, objs) { return err ? callback(err) : callback(null, common.merge(objs)); }); }; @@ -80,7 +80,7 @@ common.loadFilesSync = function (files) { var options = Array.isArray(files) ? { files: files } : files; options.format = options.format || formats.json; - return common.merge(files.map(function (file) { + return common.merge(options.files.map(function (file) { return options.format.parse(fs.readFileSync(file, 'utf8')); })); };