Skip to content

Commit a993beb

Browse files
committed
fs: avoid using forEach
PR-URL: #11582 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 5aa7d4d commit a993beb

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
@@ -248,10 +248,11 @@ function statsFromValues() {
248248
}
249249

250250
// Don't allow mode to accidentally be overwritten.
251-
['F_OK', 'R_OK', 'W_OK', 'X_OK'].forEach(function(key) {
252-
Object.defineProperty(fs, key, {
253-
enumerable: true, value: constants[key] || 0, writable: false
254-
});
251+
Object.defineProperties(fs, {
252+
F_OK: {enumerable: true, value: constants.F_OK || 0},
253+
R_OK: {enumerable: true, value: constants.R_OK || 0},
254+
W_OK: {enumerable: true, value: constants.W_OK || 0},
255+
X_OK: {enumerable: true, value: constants.X_OK || 0},
255256
});
256257

257258
function handleError(val, callback) {

0 commit comments

Comments
 (0)