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

Count with the option that params can have no value #200

Merged
merged 1 commit into from Jan 10, 2019

Conversation

honzajavorek
Copy link
Contributor

I verified the test is failing without the fix. I revamped the code a bit. It's longer, but hopefully more readable and individual parts more isolated.

module.exports = function compileParams(hrefVariablesElement) {
const params = {};
function getRequired(memberElement) {
const typeAttributes = memberElement.attributes.getValue('typeAttributes') || [];
Copy link
Member

Choose a reason for hiding this comment

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

I wonder, if it makes sense for the minim getValue API To allow you to provide a "default" value. This is similiar to Python's get(prop, default) method.

getValue('typeAttributes', []);

@honzajavorek As a Pythonist what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems like a good idea, especially for arrays. Not sure about values such as null, 0, undefined, and this kind of hell.

@honzajavorek honzajavorek merged commit 8096669 into master Jan 10, 2019
@honzajavorek honzajavorek deleted the honzajavorek/no-valueElement branch January 10, 2019 13:20
@ApiaryBot
Copy link
Collaborator

🎉 This PR is included in version 6.2.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

None yet

3 participants