-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
util: use Object.create(null) for dictionary object #3791
Changes from 1 commit
e8091ed
54285ca
c7de80b
c61e8c2
36ee9fe
7fa52db
e412b4f
56995c7
fe4cdc1
ec9f530
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,7 +159,7 @@ function stylizeNoColor(str, styleType) { | |
|
||
|
||
function arrayToHash(array) { | ||
var hash = {}; | ||
var hash = Object.create(null); | ||
|
||
array.forEach(function(val, idx) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @YuriSolovyov Hmm, It was there before I made a PR, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is not used anywhere in the scope of the function, IMO it is safe to drop it |
||
hash[val] = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You'd check if |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not a
Set
instead?