AlexGalays / idonttrustlikethat

Validation for TypeScript
40 stars 7 forks source link

Add a strict object validator #1

Closed carloslfu closed 5 years ago

carloslfu commented 6 years ago

Hi @AlexGalays , I am using validator.ts inside a project and it is so great. While using it, I find it useful to have an strict object validator, I have implemented it based on the ObjectValidator so you can see it working here. What I mean with strict is that if the object has more properties it is considered as a error. If you want I can make a PR.

AlexGalays commented 6 years ago

Hello @carloslfu

yes, I like the idea; I know it comes in handy once in a while.

A PR would be great!

AlexGalays commented 6 years ago

Do you have a use case in mind by the way? It could help me implementing it!

by the way, the last version (0.0.18) won't keep keys that were not explicitely declared in the object validator. Is that enough for you or do you really need it to fail if something else is passed?