Skip to content

Conversation

@insolite
Copy link

@insolite insolite commented Jan 5, 2020

Currently, this expression

if (convertedArguments.filter(i => i).length < 1) {

is filtering out falsy values like 0, '', null, false, etc.

This means that:

transformAll(
  [["yup.number"], ["yup.min", 0]]
).validateSync(42)

AR

Will fail with the message

ValidationError: this must be greater than or equal to undefined

ER

Will succeed, returning the 42 value.

Thoughts

I assume that it's supposed to skip only undefined values instead so I created this PR. Please correct me if I'm wrong. Thank you!

You can check that the new test with 0 fails if you remove the !== undefined part.

@tavurth
Copy link
Contributor

tavurth commented Jan 6, 2020

Thanks for the PR, unfortunately it seems like the company I used to work at which owns the copyright here is defunct and they're not accepting PRs.

I think it's probably OK to make a fork of this repo, but I can't be sure of that until they accept my PR with the license

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

Successfully merging this pull request may close these issues.

2 participants