tmpfs / async-validate

Asynchronous type validation for node and the browser
Other
314 stars 45 forks source link

Allow array values to be subject to validation rules #2

Closed tmpfs closed 9 years ago

tmpfs commented 11 years ago

This can already be done using the deep validation logic but it may be useful to validate each array entry with the same validation rule.

The typical use case would be when expecting an array whose values are all of the same type.

Something like:

{array:{type:"array", required: true, values:{type:"number"}}}
saransh2012 commented 11 years ago

Have you added this yet??

tmpfs commented 11 years ago

No, hence this issue is still open.

MarcosRava commented 10 years ago

Any updates on this?

tmpfs commented 9 years ago

Implemented in 0.4.8, see c02d5d32be5134fc36c346bff348fd24a23a3603, 75997f343ce163235d9eb5ca7f112ccf73e87710 and 3089416b32ba4f9857172e335676009d9f341243.

Test spec is here: https://github.com/freeformsystems/async-validate/blob/master/test/spec/array-values.js

Closing as implemented, create a new issue if you find a bug with this functionality.