Skip to content

Commit

Permalink
util: use Object.create(null) for dictionary object
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
JungMinu authored and jasnell committed Nov 16, 2015
1 parent c0bac95 commit 9d0396c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ function stylizeNoColor(str, styleType) {


function arrayToHash(array) {
var hash = {};
var hash = Object.create(null);

array.forEach(function(val, idx) {
array.forEach(function(val) {
hash[val] = true;
});

Expand Down

0 comments on commit 9d0396c

Please sign in to comment.