@@ -60,8 +60,8 @@ function getOptions(options, defaultOptions) {
6060}
6161
6262function copyObject(source) {
63- const target = {};
64- for (const key in source)
63+ var target = {};
64+ for (var key in source)
6565 target[key] = source[key];
6666 return target;
6767}
@@ -273,7 +273,7 @@ fs.existsSync = function(path) {
273273};
274274
275275fs.readFile = function(path, options, callback) {
276- callback = maybeCallback(arguments[arguments.length - 1] );
276+ callback = maybeCallback(callback || options );
277277 options = getOptions(options, { flag: 'r' });
278278
279279 if (handleError((path = getPathFromURL(path)), callback))
@@ -1249,9 +1249,7 @@ fs.futimesSync = function(fd, atime, mtime) {
12491249 binding.futimes(fd, atime, mtime);
12501250};
12511251
1252- function writeAll(fd, isUserFd, buffer, offset, length, position, callback_) {
1253- var callback = maybeCallback(arguments[arguments.length - 1]);
1254-
1252+ function writeAll(fd, isUserFd, buffer, offset, length, position, callback) {
12551253 // write(fd, buffer, offset, length, position, callback)
12561254 fs.write(fd, buffer, offset, length, position, function(writeErr, written) {
12571255 if (writeErr) {
@@ -1282,7 +1280,7 @@ function writeAll(fd, isUserFd, buffer, offset, length, position, callback_) {
12821280}
12831281
12841282fs.writeFile = function(path, data, options, callback) {
1285- callback = maybeCallback(arguments[arguments.length - 1] );
1283+ callback = maybeCallback(callback || options );
12861284 options = getOptions(options, { encoding: 'utf8', mode: 0o666, flag: 'w' });
12871285 const flag = options.flag || 'w';
12881286
0 commit comments