From d0fb578d6499a5fc6e6189c6239b9a75dbaedce0 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sat, 25 Feb 2017 22:52:16 -0800 Subject: [PATCH] fs: avoid using forEach PR-URL: https://github.com/nodejs/node/pull/11582 Reviewed-By: Matteo Collina Reviewed-By: Colin Ihrig --- lib/fs.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index c30de937c2afed..c1d8db9f8cb6ee 100644 --- a/lib/fs.js +++ b/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) {