RocksonZeta / koa-validate

validate koa request params and format request params
https://github.com/RocksonZeta/koa-validate
MIT License
284 stars 32 forks source link

Add ability to pass options to isInt() and toInt() #23

Closed theartoflogic closed 8 years ago

theartoflogic commented 8 years ago

This PR adds the ability to pass options to both the isInt() and toInt() functions. Along with the options, you can now also pass a radix to toInt().

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.2%) to 96.088% when pulling c602b0aa9661a57c588fb914838e1c2737a2abc4 on theartoflogic:feature/int-options into 1852a5cb613c972e920b8b747b7e7fd937b1074f on RocksonZeta:master.

theartoflogic commented 8 years ago

I need to be able to pass in options to toInt() and isInt() to support a PR I've created for the validator library (https://github.com/chriso/validator.js/pull/532). That PR adds the allow_leading_zeroes option to isInt(), which fixes an issue I'm having trying to validate integers that have leading zeroes.

However, even if that PR is ultimately not merged, this PR would still be valid, since there are other options already exposed in the isInt() and toInt() functions in the validator library that are not exposed in this library.

RocksonZeta commented 8 years ago

thanks

theartoflogic commented 8 years ago

Should I also update the README, or is that done when a new version is released?

RocksonZeta commented 8 years ago

thanks ,that's my fault