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

Refactor to use es6 features #84

Merged
merged 3 commits into from
Mar 21, 2019
Merged

Refactor to use es6 features #84

merged 3 commits into from
Mar 21, 2019

Conversation

cloudhary
Copy link
Contributor

No description provided.

@cloudhary cloudhary closed this Dec 1, 2018
@cloudhary
Copy link
Contributor Author

Sorry, opened it prematurely.

As per your comment on #77, I've used ES6 features (specifically: classes, Object.assign, let/const). This PR also includes a minor refactor of code with the creation of a expiration function. Dropped support for node 5 and added node 11 as per travis.yml.

I apologize for the one big commit. I'll change it if it's an annoyance

@cloudhary cloudhary reopened this Dec 3, 2018
@mweibel
Copy link
Owner

mweibel commented Dec 3, 2018

Thanks for the PR! Will look at it soon.

Copy link
Owner

@mweibel mweibel left a comment

Choose a reason for hiding this comment

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

That is a nice PR! Thanks a lot for it.
I found a few things which could be improved and commented on them. It's been a while since you've made this PR (sorry!) so I'd totally understand if you don't wanna fix them and will do that myself.
Otherwise there would be a few more syntax improvements but those aren't really necessary (a few cases where object property shorthand could be used).

set (sid, data, fn) {
debug('INSERT "%s"', sid)
const stringData = JSON.stringify(data)
let expires = this.expiration(data)
Copy link
Owner

Choose a reason for hiding this comment

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

I believe this can be a const


var expires
let expires = this.expiration(data)
Copy link
Owner

Choose a reason for hiding this comment

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

can be a const too, I think

expiration (data) {
if (data.cookie && data.cookie.expires) {
return data.cookie.expires
} else {
Copy link
Owner

Choose a reason for hiding this comment

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

else is not strictly needed as you return anyway

@mweibel
Copy link
Owner

mweibel commented Feb 21, 2019

Also refactoring the expiration to an own function: 👍 nice.

@cloudhary
Copy link
Contributor Author

I'm sorry I never finished this! Give me some time and I'll get to it. Thanks for your patience @mweibel!

@cloudhary
Copy link
Contributor Author

I've made the changes as proposed. Feel free to merge it in if you think it's good, and let me know if you'd like me to make any other amends.

Thank you for your patience with me @mweibel!

@mweibel mweibel merged commit 67a845b into mweibel:master Mar 21, 2019
@mweibel
Copy link
Owner

mweibel commented Mar 21, 2019

👍 thanks! Will release soon.

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