From e517b03701732538c129fab76562b557fd46ccaf Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Thu, 13 Jun 2019 17:35:29 +0200 Subject: [PATCH] process: hide NodeEnvironmentFlagsSet's `add` function This makes sure that the `add` function is not visible by default when inspecting `process.allowedNodeEnvironmentFlags`. PR-URL: https://github.com/nodejs/node/pull/28206 Reviewed-By: Richard Lau Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Rich Trott --- lib/internal/process/per_thread.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/internal/process/per_thread.js b/lib/internal/process/per_thread.js index 35e861df2b73f9..2204d7223bf344 100644 --- a/lib/internal/process/per_thread.js +++ b/lib/internal/process/per_thread.js @@ -263,7 +263,9 @@ function buildAllowedFlags() { // The super constructor consumes `add`, but // disallow any future adds. - this.add = () => this; + Object.defineProperty(this, 'add', { + value: () => this + }); } delete() {