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 nodejs#3788
`arrayToHash()` needs to use `Object.create(null)` for its dictionary object.

Refs: nodejs#3791
PR-URL: nodejs#3831
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • 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.