aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBryan English <bryan@bryanenglish.com>2018-04-04 14:47:08 -0700
committerRuben Bridgewater <ruben@bridgewater.de>2018-05-07 14:26:11 +0200
commit90e8f79f652b02a8fdf6f72e273cc81429a9376a (patch)
treeb82f3e33d9c2bee9e50f07403fc2c17ad56c63a3 /lib
parent8444bba0afd581c00d3ebf1a698f9e6322087bdc (diff)
downloadandroid-node-v8-90e8f79f652b02a8fdf6f72e273cc81429a9376a.tar.gz
android-node-v8-90e8f79f652b02a8fdf6f72e273cc81429a9376a.tar.bz2
android-node-v8-90e8f79f652b02a8fdf6f72e273cc81429a9376a.zip
constants: freeze the constants object
Constants ought to be constant. The primary goal of this commit is to make constants exposed in require('constants') immutable, as they were prior to node@7.0.0, and as the constants exposed on fs.constants, crypto.constants, etc. are. Since this is implemented by using Object.freeze, it also has the side effect of making the entire exports of require('constants') immutable, so no new constants can be defined on the object in userland. PR-URL: https://github.com/nodejs/node/pull/19813 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/constants.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/constants.js b/lib/constants.js
index 3336fd8d7f..dee4612644 100644
--- a/lib/constants.js
+++ b/lib/constants.js
@@ -32,3 +32,4 @@ Object.assign(exports,
constants.os.signals,
constants.fs,
constants.crypto);
+Object.freeze(exports);