-
Notifications
You must be signed in to change notification settings - Fork 276
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
add if (!value.hasOwnProperty(vKey)) continue; that occurred bugs! #236
base: master
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
@@ -1 +1,5 @@ | ||
node_modules | ||
.idea | ||
*.swp | ||
*.log | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ exports.validateArg = function validateArg (args, config) { | |
} | ||
if (!err && key === 'key') { | ||
for (var vKey in value) { | ||
if (!value.hasOwnProperty(vKey)) continue; | ||
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. Same as comment below. |
||
var vValue = value[vKey]; | ||
var result = validateKeySize(config, vKey, vValue); | ||
if (result.err) { | ||
|
@@ -111,6 +112,7 @@ exports.fuse = function fuse (target, handlers) { | |
// merges a object's proppertys / values with a other object | ||
exports.merge = function merge (target, obj) { | ||
for (var i in obj) { | ||
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. Might just make more sense to use 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. In fact, the formal way of If you don't, JSHint will show a warning. And of cause, this place made some bugs. 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. I've become a big fan of Object.keys over the years as well. It's pretty fast these days and you'll be iterating over an array. |
||
if (!obj.hasOwnProperty(i)) continue; | ||
target[i] = obj[i]; | ||
} | ||
|
||
|
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 remove this?
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.
Sry, this is because of my JSHint.
#the never used variables#
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.
sure, but re-defining a scoped
undefined
variable actually makes checking againstundefined
safe as you can override the globalundefined
variable with things.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.
I think the redefining
undefined
part is obsolete in node and other modern runtimes: