-
Notifications
You must be signed in to change notification settings - Fork 278
add if (!value.hasOwnProperty(vKey)) continue; that occurred bugs! #236
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
base: master
Are you sure you want to change the base?
Conversation
2739d8e to
8888021
Compare
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 against undefined safe as you can override the global undefined 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:
> undefined = 'foo'
'foo'
> undefined
undefined
|
Some minor comments but LGTM. |
|
@ronkorving @3rd-Eden So you both prefer to use |
|
I found another problem when I use If the object is This error makes TypeError: Cannot convert undefined or null to object
at Function.keys (native)
at Object.merge (/Users/XadillaX/code/node/node-memcached/lib/utils.js:113:10)
at new Client (/Users/XadillaX/code/node/node-memcached/lib/memcached.js:58:9)
at Context.<anonymous> (/Users/XadillaX/code/node/node-memcached/test/memcached-touch.test.js:21:21)
at Test.Runnable.run (/usr/local/lib/node_modules/mocha/lib/runnable.js:217:15)
at Runner.runTest (/usr/local/lib/node_modules/mocha/lib/runner.js:373:10)
at /usr/local/lib/node_modules/mocha/lib/runner.js:451:12
at next (/usr/local/lib/node_modules/mocha/lib/runner.js:298:14)
at /usr/local/lib/node_modules/mocha/lib/runner.js:308:7
at next (/usr/local/lib/node_modules/mocha/lib/runner.js:246:23)
at Immediate._onImmediate (/usr/local/lib/node_modules/mocha/lib/runner.js:275:5)
at processImmediate [as _immediateCallback] (timers.js:321:17)So I think we still should use |
|
Correct, Object.keys breaks on non-objects. A simple truthy check would address that, right? That's my preferred style. But I suggest you go with whatever style @3rd-Eden prefers. if (obj) {
var keys = Object.keys(obj);
} |
|
But doing a If the code fails with |
Before patching this patch, some functions attached to the object will be parsed and thrown errors!
For an example:
The result will be
abc- this is not my expected result!In your
for ... inof util.js:We should ignore
abcthis extended function.