-
Notifications
You must be signed in to change notification settings - Fork 10
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
Added index files to import from and added test script so Grunt doesn't have to be installed globally #17
Conversation
@Jahans3 pls fix js hint error |
@esr360 fixed errors and made a couple more changes |
|
||
exports.component = (query, operator, target = domNodes) => component({ | ||
target, | ||
module, |
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.
module,
is the same as module: module,
?!?
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.
Yeah, if you just pass the identifier you get that as the key and the value is the value of the variable
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.
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.
* @param {Object} [parser] - custom parser to use for configuration | ||
* @returns {*} | ||
*/ | ||
export function getOptions ({ config = {}, parser, custom = {} } = {}) { |
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 ({ config = {}, parser, custom = {} } = {}) {
instead of (config = {}, parser, custom = {}) {
?
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.
Using named parameters is just a good habit to get into.
They allow you to pass arguments in at any position, so it's one less thing that can go wrong.
Partial application (not always using all parameters) is simpler since you don't need to ever do anything like: someFunc(arg1, null, arg3)
.
You can also easily rename them too: ({ arg: someArg }) => {}
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 mean it's technically just destructuring an object but it's basically named params
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.
Also means you can make the params non optional and throw an error by just leaving out the = {}
at the very end
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.
After like an hour reading I get it now! It just looks weird having things like = {} } = {}) {
in your code but yeah it makes sense
Will pull it and run a smoke bomb local test to ensure it's all good then will grit push submerge the PR |
No description provided.