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>
This commit is contained in:
Minwoo Jung 2015-11-15 13:56:05 +09:00 committed by James M Snell
parent c0bac95147
commit 9d0396cd63

View File

@ -159,9 +159,9 @@ function stylizeNoColor(str, styleType) {
function arrayToHash(array) { function arrayToHash(array) {
var hash = {}; var hash = Object.create(null);
array.forEach(function(val, idx) { array.forEach(function(val) {
hash[val] = true; hash[val] = true;
}); });