Skip to content
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

Fix conditional to check if there is a result returned from Server method #6

Merged
merged 4 commits into from
Mar 22, 2018

Conversation

cmerchant
Copy link
Contributor

No description provided.

@coveralls
Copy link

coveralls commented Mar 22, 2018

Coverage Status

Coverage increased (+0.4%) to 90.845% when pulling 003f8c9 on falseFix into 0baa8aa on master.

@@ -99,7 +99,7 @@ export class Client {
}

// resolve when a result is received
if (response && response.result) {
if (response && typeof response.result !== 'undefined') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the original if statement will actually properly filter if the response.result is truly undefined and this statement check is more specific and feels unnecessary in this case... was this a change for testing purposes that can be backed out?

@@ -204,7 +204,7 @@ export class Server extends EventEmitter {
}

// handle synchronous results
if (result && (!result.then || typeof result.then !== 'function')) {
if (typeof result !== 'undefined' && (!result.then || typeof result.then !== 'function')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above... if (result) will result in the same result as if (typeof result !== 'undefined'), but is more generic and a tad tighter in terms of implementation (plus more consistent with the rest of the code base). Is this a vestige from testing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I think I see... the issue is that the result from the call is actually a scalar boolean value of false. In this case, your code change makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants