-
Notifications
You must be signed in to change notification settings - Fork 46
Housekeeping #23
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?
Housekeeping #23
Conversation
- sorting `package.json` fields - adding `files` field
- adding strict pragmas
- dynamic recognition of `next` callback
davidbanham
left a comment
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.
Looks great in general, thanks! Just have a couple questions on the refactor internals commit.
| return Object.keys(source).reduce((acc, key) => { | ||
| const value = source[key]; | ||
| return Object.assign(acc, { [key]: value }); | ||
| }, dest); |
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.
Can you expand on the reason for this refactor?
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 thought reduce serves better purpose conveying message to the reader because source object is reduced (Yeah it is mapped but every mapper is in fact a reducer) to destination one. Plus reduce has return value compared to forEach which I thought is neat and leveraged here.
| const originalParam = Router.prototype.constructor.param; | ||
| Router.prototype.constructor.param = function param(name, fn) { | ||
| fn = wrap(fn); | ||
| return originalParam.call(this, name, fn); |
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.
Do we not change the value of this by removing this section from the wrap closure?
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.
Value of this in this case is determined by Router#param callsite and explicitly forwarded to original implementation using .call binding so it is preserved. Moving it out of a function doesn't change it.
This PR brings in following changes:
.editorconfig.gitignore, ESLint & Travis CI confignpmleftovers - completed migration toyarnnextcallback resolution)