Browse Source

fs: avoid using forEach

PR-URL: https://github.com/nodejs/node/pull/11582
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
v7.x
James M Snell 8 years ago
committed by Italo A. Casas
parent
commit
d0fb578d64
No known key found for this signature in database GPG Key ID: 23EFEFE93C4CFFFE
  1. 9
      lib/fs.js

9
lib/fs.js

@ -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) {

Loading…
Cancel
Save