Skip to content

Commit d0fb578

Browse files
jasnellItalo A. Casas
authored andcommitted
fs: avoid using forEach
PR-URL: #11582 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 80949f3 commit d0fb578

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

‎lib/fs.js‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,11 @@ fs.Stats.prototype.isSocket = function(){
200200
};
201201

202202
// Don't allow mode to accidentally be overwritten.
203-
['F_OK','R_OK','W_OK','X_OK'].forEach(function(key){
204-
Object.defineProperty(fs,key,{
205-
enumerable: true,value: constants[key]||0,writable: false
206-
});
203+
Object.defineProperties(fs,{
204+
F_OK: {enumerable: true,value: constants.F_OK||0},
205+
R_OK: {enumerable: true,value: constants.R_OK||0},
206+
W_OK: {enumerable: true,value: constants.W_OK||0},
207+
X_OK: {enumerable: true,value: constants.X_OK||0},
207208
});
208209

209210
functionhandleError(val,callback){

0 commit comments

Comments
(0)