From 8fef99a45020eb48715f5158dab87453a3b5e685 Mon Sep 17 00:00:00 2001 From: Jo Liss Date: Thu, 3 Apr 2014 23:22:20 +0000 Subject: [PATCH] Remove redundant check We default opts to {} at the top of the function. Also fix indentation. --- lib/wrench.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/lib/wrench.js b/lib/wrench.js index 01f5e95..16b9ded 100644 --- a/lib/wrench.js +++ b/lib/wrench.js @@ -231,9 +231,9 @@ exports.copyDirSyncRecursive = function(sourceDir, newDirLocation, opts) { opts = opts || {}; try { - if(fs.statSync(newDirLocation).isDirectory()) { + if(fs.statSync(newDirLocation).isDirectory()) { if(opts.forceDelete) { - exports.rmdirSyncRecursive(newDirLocation); + exports.rmdirSyncRecursive(newDirLocation); } else { return new Error('You are trying to delete a directory that already exists. Specify forceDelete in the opts argument to override this. Bailing~'); } @@ -256,15 +256,9 @@ exports.copyDirSyncRecursive = function(sourceDir, newDirLocation, opts) { for(var i = 0; i < files.length; i++) { // ignores all files or directories which match the RegExp in opts.filter - if(typeof opts !== 'undefined') { - if (hasFilter) { - if (!isFileIncluded(opts, sourceDir, files[i])) { - continue; - } - } - - if (opts.excludeHiddenUnix && /^\./.test(files[i])) continue; - } + if (hasFilter && !isFileIncluded(opts, sourceDir, files[i])) continue; + + if (opts.excludeHiddenUnix && /^\./.test(files[i])) continue; var currFile = fs.lstatSync(_path.join(sourceDir, files[i]));