From d1921dce9695d0737303cd02c4a8d99e364d15c9 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 31 Jan 2014 06:04:49 -0500 Subject: [PATCH] refactor(commander) getDirContent: add bind --- lib/server/commander.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/server/commander.js b/lib/server/commander.js index 07c4943d..b3e5b317 100644 --- a/lib/server/commander.js +++ b/lib/server/commander.js @@ -25,12 +25,10 @@ if (!ret) Util.exec(callback, "First parameter should be a string"); else - fs.readdir(path, function(error, files) { - readDir(error, files, { - callback : callback, - path : path - }); - }); + fs.readdir(path, readDir.bind(null, { + callback : callback, + path : path + })); return ret; }; @@ -41,7 +39,7 @@ * @param pError * @param pFiles */ - function readDir(error, files, params) { + function readDir(params, error, files) { var i, n, stats, filesData, fill, name, fileParams, p = params,