silfverorg / duns.js

Javascript schema validator
5 stars 2 forks source link

Add an all/any type #9

Closed br0r closed 9 years ago

br0r commented 9 years ago

Sometimes it doesn't really matter what type a variable is, it simple needs to exist. Therefore there should exist some kind of "all catcher" type.

Duns.validate(['5', 5], Duns.array().items([
  Duns.any().disallow('4')
]));
silfverstrom commented 9 years ago

Yes i agree - this is an important addition. 0.1?

br0r commented 9 years ago

As as response to the Pull Request, shouldn't all validators be an extension of the any validator? Using es6 class extend this could be done quite easy.

silfverstrom commented 9 years ago

Yes I agree. I thought about it in the end when I realised there was quite some duplicates. My thought was to get the functionality in place, and then do some cleanup in 0.2 release when all 0.1 functionality is done.

br0r commented 9 years ago

All right! I'll close this issue and open a new with 0.2 milestone.