WireframesJPN / simple-valid

0 stars 3 forks source link

Validating Array length on "required" #19

Open tomoshim opened 3 years ago

tomoshim commented 3 years ago

On Laravel, required can check length of Countable objects. I propose that required rejects if an empty array is given.

https://readouble.com/laravel/8.x/ja/validation.html#rule-required

tomoshim commented 3 years ago

@wireframeslayout Can the milestone 0.7.0 accept this change?

tomoshim commented 3 years ago

@wireframeslayout How about checking the length of ArrayLike? I mean ArrayLike is an object with length property, which is not array, for example NodeList for Web API. It has some elements and can be iterable(looping with for).