Skip to content

Commit

Permalink
fs: avoid using forEach
Browse files Browse the repository at this point in the history
PR-URL: #11582
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
jasnell authored and italoacasas committed Mar 20, 2017
1 parent 80949f3 commit d0fb578
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,11 @@ fs.Stats.prototype.isSocket = function() {
};

// Don't allow mode to accidentally be overwritten.
['F_OK', 'R_OK', 'W_OK', 'X_OK'].forEach(function(key) {
Object.defineProperty(fs, key, {
enumerable: true, value: constants[key] || 0, writable: false
});
Object.defineProperties(fs, {
F_OK: {enumerable: true, value: constants.F_OK || 0},
R_OK: {enumerable: true, value: constants.R_OK || 0},
W_OK: {enumerable: true, value: constants.W_OK || 0},
X_OK: {enumerable: true, value: constants.X_OK || 0},
});

function handleError(val, callback) {
Expand Down

0 comments on commit d0fb578

Please sign in to comment.