Browse Source

util: use Object.create(null) for dictionary object

Fixes https://github.com/nodejs/node/issues/3788
`arrayToHash()` needs to use `Object.create(null)` for its dictionary object.

Refs: https://github.com/nodejs/node/pull/3791
PR-URL: https://github.com/nodejs/node/pull/3831
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
process-exit-stdio-flushing
Minwoo Jung 9 years ago
committed by James M Snell
parent
commit
9d0396cd63
  1. 4
      lib/util.js

4
lib/util.js

@ -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;
});

Loading…
Cancel
Save