rickharrison/validate.js — pull request #67 by TimBenjamin (2013-04-12 09:09:59+00:00)
Title: Added 4 new rules

added 4 new rules which I needed in my customer's use of validate.js:

- numeric_or_empty
- integer_or_empty
- decimal_or_empty
- is_natural_or_empty

The use case for this was that the customer was collecting prices in a field. I had used is_natural (they wanted whole positive numbers only) and where there was no data available (i.e. "unknown or not applicable") the users were entering zero. This was skewing the customer's analysis because the "zero" value looked like an actual zero price (thereby lowering average prices).

Having created is_natural_or_empty I thought it would be useful to have versions for the other number-related checks.