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

fix(optional): allows blank values in optional keys #62

Merged
merged 1 commit into from
Apr 9, 2020

Conversation

goldcaddy77
Copy link
Contributor

@goldcaddy77 goldcaddy77 commented Apr 8, 2020

Addresses #61

b3ross
b3ross previously approved these changes Apr 9, 2020
@@ -16,10 +16,10 @@ export function parse(contents: string, stage?: string): InputDocument {
const value = document[key];
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
result[key] = { value: value };
} else if (value.optional && value.value) {
} else if (value.optional && typeof value.value !== 'undefined') {
Copy link
Owner

Choose a reason for hiding this comment

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

Any reason for using typeof here instead of just checking for undefined? Any issue with swapping that out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It’s the safest way to do this check. undefined can actually be reassigned so this has been established at the best practice.

https://stackoverflow.com/questions/4725603/variable-undefined-vs-typeof-variable-undefined

Happy to change if you want though.

Copy link
Owner

Choose a reason for hiding this comment

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

God I hate JavaScript sometimes lol

@b3ross b3ross dismissed their stale review April 9, 2020 04:09

Had one nitty comment to touch base on

@b3ross b3ross merged commit 3019d52 into b3ross:master Apr 9, 2020
@b3ross
Copy link
Owner

b3ross commented Apr 9, 2020

🎉 This PR is included in version 0.8.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@b3ross b3ross added the released label Apr 9, 2020
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.

2 participants