Browse Source

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.
v0.11.8-release
Jeff Switzer 12 years ago
committed by Ben Noordhuis
parent
commit
2e13d0ce17
  1. 6
      lib/fs.js

6
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');
}

Loading…
Cancel
Save