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

Allow cast booleans #34

Merged
merged 3 commits into from Oct 30, 2012
Merged

Allow cast booleans #34

merged 3 commits into from Oct 30, 2012

Conversation

ixti
Copy link
Contributor

@ixti ixti commented Oct 29, 2012

In continuation of #26.
Extends cast option to properly cast boolean values (as they normally received from the web forms)

@puzrin
Copy link

puzrin commented Oct 29, 2012

@pksunkara , sinse pull requests were frozen for a long time, we maintained our fork and did not provided latest patches. Please, accept this one, because #26 was for integers only, and in real life boolean values happens very often.

After that, we will be able to switch back to your original revalidator branch.

pksunkara added a commit that referenced this pull request Oct 30, 2012
@pksunkara pksunkara merged commit c31254d into flatiron:master Oct 30, 2012
@rlidwka
Copy link

rlidwka commented Nov 17, 2012

What do you think about a flag that would actually modify input to make it valid?

I mean like that:

var input = {test:123};
typeof(input.test) === 'number';

require('revalidator').validate(input, {properties:{test:{type:'string'}}}, {cast:true});
typeof(input.test) === 'string';

So an application will always get a correct type after validation. Does it make sense?

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.

None yet

4 participants