Skip to content
Prev Previous commit
Next Next commit
fs: avoid using forEach
  • Loading branch information
jasnell committed Mar 15, 2017
commit ebe8926025601fccfec9798b581f7f89e53a3526
9 changes: 5 additions & 4 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,11 @@ function statsFromValues() {
}

// 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