silfverorg / duns.js

Javascript schema validator
5 stars 2 forks source link

Add oneOf method #10

Closed br0r closed 9 years ago

br0r commented 9 years ago

Sometimes you'll accept more than one type as argument. There needs to be a .oneOf method to accept it. It should extend the any object of some so it'll be able to chain format on it.

Duns('5').schema(Duns.oneOf([Duns.string(), Duns.number()]).format((num) => +num)).validate().format();
silfverstrom commented 9 years ago

+1 - feels rather important. 0.1?