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

_validateWithFlags breaks prog.LIST #39

Closed
indieisaconcept opened this issue Mar 27, 2017 · 2 comments
Closed

_validateWithFlags breaks prog.LIST #39

indieisaconcept opened this issue Mar 27, 2017 · 2 comments

Comments

@indieisaconcept
Copy link

indieisaconcept commented Mar 27, 2017

@mattallty I was intending to use prog.LIST and was reviewing the pizza example and found that I was not getting the expected result.

Consider the following

-add-ingredients=a,b => { addIngredients : undefined }
-add-ingredients a,b => { addIngredients : [undefined, undefined }

I reviewed the code and the issue appears to be caused by _validateWithFlags and an omission of an early return statement when running in unary mode.

As the function calls itself for each value in the Array it will not pass the subsequent validation checks.

 _validateWithFlags(value, unary) {
    if (unary) { return value; } 
    ....
}

Though value.map and calling itself seems be redundant.

@mattallty
Copy link
Owner

Thanks @indieisaconcept , PR #43 should fix this

@indieisaconcept
Copy link
Author

@mattallty awesome, thanks!

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

No branches or pull requests

2 participants