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

Use Coffeescript conditional assignment shorthand #574

Merged
merged 2 commits into from
Apr 10, 2020
Merged

Use Coffeescript conditional assignment shorthand #574

merged 2 commits into from
Apr 10, 2020

Conversation

sionleroux
Copy link
Contributor

This is a really minor syntax-only change and shouldn't affect behaviour at all.

Because what we're assigning in the happy side of this condition is the same as what we're checking in its expression we can use Coffeescript's shorthand with the existential operator, i.e. instead of

a = if b? then b else c

use this:

a = b ? c

Source: https://coffeescript.org/#existential-operator

Summary

Describe the goal of this PR. Mention any related Issue numbers.

Requirements (place an x in each [ ])

sionleroux and others added 2 commits August 22, 2019 01:23
Because what we're assigning in the happy side of this condition is the
same as what we're checking in its expression we can use Coffeescript's
shorthand with the existential operator, i.e. instead of

    a = if b? then b else c

use this:

    a = b ? c

Source: https://coffeescript.org/#existential-operator
Copy link
Member

@seratch seratch left a comment

Choose a reason for hiding this comment

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

LGTM.

Just in case:

$ coffee 
coffee> foo = "a"
'a'
coffee> bar = foo ? "b"
'a'
coffee> baz = undefined
undefined
coffee> bar = baz ? "b"
'b'

@codecov
Copy link

codecov bot commented Apr 10, 2020

Codecov Report

Merging #574 into master will increase coverage by 0.25%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #574      +/-   ##
==========================================
+ Coverage   84.93%   85.19%   +0.25%     
==========================================
  Files           6        6              
  Lines         385      385              
  Branches       85       84       -1     
==========================================
+ Hits          327      328       +1     
  Misses         34       34              
+ Partials       24       23       -1     
Impacted Files Coverage Δ
src/bot.coffee 74.50% <100.00%> (+0.98%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bd319b7...16986a6. Read the comment docs.

@seratch
Copy link
Member

seratch commented Apr 10, 2020

@sinisterstuf Thanks for taking the time to make this PR. LGTM 👍

@seratch seratch merged commit c003c3b into slackapi:master Apr 10, 2020
@sionleroux sionleroux deleted the if-channel branch April 10, 2020 06:20
@seratch seratch modified the milestones: 4.8.0, 4.9.0 Apr 24, 2020
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.

2 participants