From 8bfa43d35294005cc79708f644f222c082eed366 Mon Sep 17 00:00:00 2001 From: Luis Lobo Borobia Date: Fri, 27 Mar 2015 18:01:35 -0300 Subject: [PATCH 1/2] Adds an option so that the file result can be sorted --- index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 641bae1..52c572b 100644 --- a/index.js +++ b/index.js @@ -40,6 +40,13 @@ module.exports = function requireAll(options) { else throw new Error('Directory not found: ' + options.dirname); } + // Sort the result + if (!!options.sortResult) { + files = files.sort(function(a, b) { + return a < b ? -1 : 1; + }); + } + // Iterate through files in the current directory files.forEach(function(file) { var filepath = options.dirname + '/' + file; @@ -137,4 +144,4 @@ module.exports = function requireAll(options) { function excludeDirectory(dirname) { return options.excludeDirs && dirname.match(options.excludeDirs); } -}; \ No newline at end of file +}; From 8ba5d24f81aee298878fecda1cff14b198028f5d Mon Sep 17 00:00:00 2001 From: Luis Lobo Borobia Date: Fri, 27 Mar 2015 18:05:05 -0300 Subject: [PATCH 2/2] Incremented version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6fae697..c8a7792 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "include-all", - "version": "0.1.6", + "version": "0.1.7", "description": "An easy way to include all node.js modules within a directory. This is a fork of felixge's awesome module, require-all (https://github.com/felixge/node-require-all) which adds the ability to mark an include as **optional**.", "main": "index.js", "directories": {