Skip to content

Commit 9d0396c

Browse files
JungMinujasnell
authored andcommitted
util: use Object.create(null) for dictionary object
Fixes #3788 `arrayToHash()` needs to use `Object.create(null)` for its dictionary object. Refs: #3791 PR-URL: #3831 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent c0bac95 commit 9d0396c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/util.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ function stylizeNoColor(str, styleType) {
159159

160160

161161
function arrayToHash(array) {
162-
var hash = {};
162+
var hash = Object.create(null);
163163

164-
array.forEach(function(val, idx) {
164+
array.forEach(function(val) {
165165
hash[val] = true;
166166
});
167167

0 commit comments

Comments
 (0)