From 2e13d0ce17d75b30db22dea058f35207ecf1ad66 Mon Sep 17 00:00:00 2001 From: Jeff Switzer Date: Thu, 26 Sep 2013 23:03:59 -0400 Subject: [PATCH] fs: remove duplicate !options case I haven't actually tested this code, but was reading it due to a post that linked to the code here: http://dailyjs.com/2013/09/26/libuv/ As I was reading through the code, I noticed a path that can't be reached. I didn't strictly follow the contributing guide: https://github.com/joyent/node/wiki/Contributing but the change seems safe. Feel free to close this out. I'm not sure if it was just an oversight or what. --- lib/fs.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index eb204c0..0e915aa 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -175,8 +175,6 @@ fs.readFile = function(path, options, callback_) { options = { encoding: null, flag: 'r' }; } else if (util.isString(options)) { options = { encoding: options, flag: 'r' }; - } else if (!options) { - options = { encoding: null, flag: 'r' }; } else if (!util.isObject(options)) { throw new TypeError('Bad arguments'); } @@ -919,8 +917,6 @@ fs.writeFile = function(path, data, options, callback) { options = { encoding: 'utf8', mode: 438 /*=0666*/, flag: 'w' }; } else if (util.isString(options)) { options = { encoding: options, mode: 438, flag: 'w' }; - } else if (!options) { - options = { encoding: 'utf8', mode: 438 /*=0666*/, flag: 'w' }; } else if (!util.isObject(options)) { throw new TypeError('Bad arguments'); } @@ -976,8 +972,6 @@ fs.appendFile = function(path, data, options, callback_) { options = { encoding: 'utf8', mode: 438 /*=0666*/, flag: 'a' }; } else if (util.isString(options)) { options = { encoding: options, mode: 438, flag: 'a' }; - } else if (!options) { - options = { encoding: 'utf8', mode: 438 /*=0666*/, flag: 'a' }; } else if (!util.isObject(options)) { throw new TypeError('Bad arguments'); } -- 2.7.4