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:
parent
c0bac95147
commit
9d0396cd63
@ -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;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user