fs: remove duplicate !options case
authorJeff Switzer <git@skratchdot.com>
Fri, 27 Sep 2013 03:03:59 +0000 (23:03 -0400)
committerBen Noordhuis <info@bnoordhuis.nl>
Fri, 27 Sep 2013 07:17:55 +0000 (09:17 +0200)
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

index eb204c0..0e915aa 100644 (file)
--- 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');
   }