From 76e9008e99569995338c409f3155cc1d6421dced Mon Sep 17 00:00:00 2001 From: Daniel Nalborczyk Date: Thu, 6 Jun 2019 17:08:00 -0400 Subject: [PATCH] util: use Set to store deprecation codes --- lib/internal/util.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/internal/util.js b/lib/internal/util.js index ed2493d9b4a814..931bcea5b4fbfb 100644 --- a/lib/internal/util.js +++ b/lib/internal/util.js @@ -35,7 +35,7 @@ function isError(e) { // Keep a list of deprecation codes that have been warned on so we only warn on // each one once. -const codesWarned = {}; +const codesWarned = new Set(); // Mark that a method should not be used. // Returns a modified function which warns once by default. @@ -53,9 +53,9 @@ function deprecate(fn, msg, code) { if (!warned) { warned = true; if (code !== undefined) { - if (!codesWarned[code]) { + if (!codesWarned.has(code)) { process.emitWarning(msg, 'DeprecationWarning', code, deprecated); - codesWarned[code] = true; + codesWarned.add(code); } } else { process.emitWarning(msg, 'DeprecationWarning', deprecated);