Skip to content

Commit dfdf742

Browse files
dnalborczykBridgeAR
authored andcommitted
util: use Set to store deprecation codes
PR-URL: #28113 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent e6ecc13 commit dfdf742

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/internal/util.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function isError(e) {
3535

3636
// Keep a list of deprecation codes that have been warned on so we only warn on
3737
// each one once.
38-
const codesWarned = {};
38+
const codesWarned = new Set();
3939

4040
// Mark that a method should not be used.
4141
// Returns a modified function which warns once by default.
@@ -53,9 +53,9 @@ function deprecate(fn, msg, code) {
5353
if (!warned) {
5454
warned = true;
5555
if (code !== undefined) {
56-
if (!codesWarned[code]) {
56+
if (!codesWarned.has(code)) {
5757
process.emitWarning(msg, 'DeprecationWarning', code, deprecated);
58-
codesWarned[code] = true;
58+
codesWarned.add(code);
5959
}
6060
} else {
6161
process.emitWarning(msg, 'DeprecationWarning', deprecated);

0 commit comments

Comments
 (0)